Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Bugfix make_room_admin fails for users that have left a private room (
Browse files Browse the repository at this point in the history
#10367)

Fixes: #10338
  • Loading branch information
dklimpel authored Jul 13, 2021
1 parent 9372971 commit d9b3637
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/10367.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bugfix `make_room_admin` fails for users that have left a private room.
9 changes: 8 additions & 1 deletion synapse/rest/admin/rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ def __init__(self, hs: "HomeServer"):
super().__init__(hs)
self.hs = hs
self.auth = hs.get_auth()
self.store = hs.get_datastore()
self.event_creation_handler = hs.get_event_creation_handler()
self.state_handler = hs.get_state_handler()
self.is_mine_id = hs.is_mine_id
Expand Down Expand Up @@ -500,7 +501,13 @@ async def on_POST(
admin_user_id = None

for admin_user in reversed(admin_users):
if room_state.get((EventTypes.Member, admin_user)):
(
current_membership_type,
_,
) = await self.store.get_local_current_membership_for_user_in_room(
admin_user, room_id
)
if current_membership_type == "join":
admin_user_id = admin_user
break

Expand Down

0 comments on commit d9b3637

Please sign in to comment.