summary refs log tree commit diff
path: root/synapse/handlers/room_member.py
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2022-08-24 14:13:12 -0500
committerGitHub <noreply@github.com>2022-08-24 14:13:12 -0500
commitd58615c82cec5bd866bedcb33e3e2a5d2a961c44 (patch)
tree0c876b95db99f6c927adc011120f6953c38e7d3e /synapse/handlers/room_member.py
parentWhen loading current ids, sort by `stream_id` to avoid incorrect overwrite an... (diff)
downloadsynapse-d58615c82cec5bd866bedcb33e3e2a5d2a961c44.tar.xz
Directly lookup local membership instead of getting all members in a room first (`get_users_in_room` mis-use) (#13608)
See https://github.com/matrix-org/synapse/pull/13575#discussion_r953023755
Diffstat (limited to 'synapse/handlers/room_member.py')
-rw-r--r--synapse/handlers/room_member.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index 65b9a655d4..709682622f 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -1620,8 +1620,10 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
     async def _is_server_notice_room(self, room_id: str) -> bool:
         if self._server_notices_mxid is None:
             return False
-        user_ids = await self.store.get_users_in_room(room_id)
-        return self._server_notices_mxid in user_ids
+        is_server_notices_room = await self.store.check_local_user_in_room(
+            user_id=self._server_notices_mxid, room_id=room_id
+        )
+        return is_server_notices_room
 
 
 class RoomMemberMasterHandler(RoomMemberHandler):