summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-09-14 15:53:18 +0000
committerGitHub <noreply@github.com>2022-09-14 15:53:18 +0000
commit6302753012927b63feddc71dd287e2d3554707d4 (patch)
treef6ef20890b30492f604a3ac2e4e9d7b8daa87a9b /synapse/handlers/message.py
parentFix a memory leak when running the unit tests. (#13798) (diff)
downloadsynapse-6302753012927b63feddc71dd287e2d3554707d4.tar.xz
Deduplicate `is_server_notices_room`. (#13780)
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 72157d5a36..e07cda133a 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -752,20 +752,12 @@ class EventCreationHandler:
         if builder.type == EventTypes.Member:
             membership = builder.content.get("membership", None)
             if membership == Membership.JOIN:
-                return await self._is_server_notices_room(builder.room_id)
+                return await self.store.is_server_notice_room(builder.room_id)
             elif membership == Membership.LEAVE:
                 # the user is always allowed to leave (but not kick people)
                 return builder.state_key == requester.user.to_string()
         return False
 
-    async def _is_server_notices_room(self, room_id: str) -> bool:
-        if self.config.servernotices.server_notices_mxid is None:
-            return False
-        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