summary refs log tree commit diff
path: root/synapse/rest/admin/rooms.py
diff options
context:
space:
mode:
authorDirk Klimpel <5740567+dklimpel@users.noreply.github.com>2021-07-13 12:53:45 +0200
committerGitHub <noreply@github.com>2021-07-13 11:53:45 +0100
commitd9b3637e446ca639b64be05e8a27d1c2ea23c589 (patch)
tree9680643a5f3ad0c4b25922c23ed43e30b3be9492 /synapse/rest/admin/rooms.py
parentUse inline type hints in `tests/` (#10350) (diff)
downloadsynapse-d9b3637e446ca639b64be05e8a27d1c2ea23c589.tar.xz
Bugfix `make_room_admin` fails for users that have left a private room (#10367)
Fixes: #10338
Diffstat (limited to '')
-rw-r--r--synapse/rest/admin/rooms.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/rest/admin/rooms.py b/synapse/rest/admin/rooms.py
index f0cddd2d2c..3c51a742bf 100644
--- a/synapse/rest/admin/rooms.py
+++ b/synapse/rest/admin/rooms.py
@@ -462,6 +462,7 @@ class MakeRoomAdminRestServlet(ResolveRoomIdMixin, RestServlet):
         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
@@ -500,7 +501,13 @@ class MakeRoomAdminRestServlet(ResolveRoomIdMixin, RestServlet):
             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