summary refs log tree commit diff
path: root/synapse/handlers/room.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r--synapse/handlers/room.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index dbcfb8990f..7c24f9aac3 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -79,6 +79,8 @@ class RoomCreationHandler(BaseHandler):
 
         self._server_notices_mxid = hs.config.server_notices_mxid
 
+        self.third_party_event_rules = hs.get_third_party_event_rules()
+
     @defer.inlineCallbacks
     def upgrade_room(self, requester, old_room_id, new_version):
         """Replace a room with a new room with a different version
@@ -489,9 +491,6 @@ class RoomCreationHandler(BaseHandler):
 
         yield self.auth.check_auth_blocking(user_id)
 
-        invite_list = config.get("invite", [])
-        invite_3pid_list = config.get("invite_3pid", [])
-
         if (self._server_notices_mxid is not None and
                 requester.user.to_string() == self._server_notices_mxid):
             # allow the server notices mxid to create rooms
@@ -501,6 +500,17 @@ class RoomCreationHandler(BaseHandler):
                 requester.user,
             )
 
+        # Check whether the third party rules allows/changes the room create
+        # request.
+        yield self.third_party_event_rules.on_create_room(
+            requester,
+            config,
+            is_requester_admin=is_requester_admin,
+        )
+
+        invite_list = config.get("invite", [])
+        invite_3pid_list = config.get("invite_3pid", [])
+
         if not is_requester_admin and not self.spam_checker.user_may_create_room(
             user_id,
             invite_list=invite_list,