summary refs log tree commit diff
path: root/synapse/handlers/message.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/message.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/message.py')
-rw-r--r--synapse/handlers/message.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index acd3de06f6..72157d5a36 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -761,8 +761,10 @@ class EventCreationHandler:
     async def _is_server_notices_room(self, room_id: str) -> bool:
         if self.config.servernotices.server_notices_mxid is None:
             return False
-        user_ids = await self.store.get_users_in_room(room_id)
-        return self.config.servernotices.server_notices_mxid in user_ids
+        is_server_notices_room = await self.store.check_local_user_in_room(
+            user_id=self.config.servernotices.server_notices_mxid, room_id=room_id
+        )
+        return is_server_notices_room
 
     async def assert_accepted_privacy_policy(self, requester: Requester) -> None:
         """Check if a user has accepted the privacy policy