summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-09-30 17:14:55 +0100
committerErik Johnston <erik@matrix.org>2015-09-30 17:14:55 +0100
commit0ec78b360c71eec0ff2fedfd95f7ad555edfb3f1 (patch)
treedd840f81ec7d4d838e2effeac2c07433244d5d40
parentMerge pull request #288 from matrix-org/markjh/unused_definitions (diff)
parentRemove double indentation (diff)
downloadsynapse-0ec78b360c71eec0ff2fedfd95f7ad555edfb3f1.tar.xz
Merge pull request #287 from matrix-org/erikj/canonical_alias
Set m.room.canonical_alias on room creation.
Diffstat (limited to '')
-rw-r--r--synapse/handlers/room.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 773f0a2e92..b677955523 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -155,6 +155,7 @@ class RoomCreationHandler(BaseHandler):
             preset_config=preset_config,
             invite_list=invite_list,
             initial_state=initial_state,
+            room_alias=room_alias,
         )
 
         msg_handler = self.hs.get_handlers().message_handler
@@ -202,7 +203,7 @@ class RoomCreationHandler(BaseHandler):
         defer.returnValue(result)
 
     def _create_events_for_new_room(self, creator, room_id, preset_config,
-                                    invite_list, initial_state):
+                                    invite_list, initial_state, room_alias):
         config = RoomCreationHandler.PRESETS_DICT[preset_config]
 
         creator_id = creator.to_string()
@@ -271,6 +272,14 @@ class RoomCreationHandler(BaseHandler):
 
             returned_events.append(power_levels_event)
 
+        if room_alias and (EventTypes.CanonicalAlias, '') not in initial_state:
+            room_alias_event = create(
+                etype=EventTypes.CanonicalAlias,
+                content={"alias": room_alias.to_string()},
+            )
+
+            returned_events.append(room_alias_event)
+
         if (EventTypes.JoinRules, '') not in initial_state:
             join_rules_event = create(
                 etype=EventTypes.JoinRules,