Skip to content

Commit

Permalink
Merge pull request #111 from JOJ0/fix-regtok-delete
Browse files Browse the repository at this point in the history
Fix regtok delete and others
  • Loading branch information
JacksonChen666 authored Jun 14, 2023
2 parents 11c7db7 + 47aa900 commit ca97201
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions synadm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,8 +1148,8 @@ def regtok_details(self, token, readable_expiry):
an exception occured. See Synapse admin API docs for details.
"""
result = self.query("get", "v1/registration_tokens/{token}",
token=token)
result = self.query("get", "v1/registration_tokens/{t}",
t=token)

# Change expiry_time to a human readable format if requested
if (
Expand Down Expand Up @@ -1244,8 +1244,8 @@ def regtok_update(self, token, uses_allowed, expiry_ts, expire_at):
self.log.debug(f"Received --expire-at: {expire_at}")
data["expiry_time"] = self._timestamp_from_datetime(expire_at)

return self.query("put", "v1/registration_tokens/{token}", data=data,
token=token)
return self.query("put", "v1/registration_tokens/{t}", data=data,
t=token)

def regtok_delete(self, token):
""" Delete a registration token
Expand All @@ -1258,8 +1258,11 @@ def regtok_delete(self, token):
an exception occured. See Synapse admin API docs for details.
"""
return self.query("delete", "v1/registration_tokens/{token}",
token=token)
# t because query also accepts token when we want it for the
# request
# https://github.com/JOJ0/synadm/issues/110#issuecomment-1590032158
return self.query("delete", "v1/registration_tokens/{t}",
t=token)

def user_shadow_ban(self, user_id, unban):
""" Shadow-ban or unban a user.
Expand Down

0 comments on commit ca97201

Please sign in to comment.