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.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index cfe1061ed3..bfbd7f9783 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -106,6 +106,15 @@ class RoomCreationHandler(BaseHandler):
             if not room_id:
                 raise StoreError(500, "Couldn't generate a room ID.")
 
+        if room_alias:
+            directory_handler = self.hs.get_handlers().directory_handler
+            yield directory_handler.create_association(
+                user_id=user_id,
+                room_id=room_id,
+                room_alias=room_alias,
+                servers=[self.hs.hostname],
+            )
+
         user = self.hs.parse_userid(user_id)
         creation_events = self._create_events_for_new_room(
             user, room_id, is_public=is_public
@@ -180,13 +189,7 @@ class RoomCreationHandler(BaseHandler):
 
         if room_alias:
             result["room_alias"] = room_alias.to_string()
-            directory_handler = self.hs.get_handlers().directory_handler
-            yield directory_handler.create_association(
-                user_id=user_id,
-                room_id=room_id,
-                room_alias=room_alias,
-                servers=[self.hs.hostname],
-            )
+            directory_handler.send_room_alias_update_event(user_id, room_id)
 
         defer.returnValue(result)