Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #287 from matrix-org/erikj/canonical_alias
Browse files Browse the repository at this point in the history
Set m.room.canonical_alias on room creation.
  • Loading branch information
erikjohnston committed Sep 30, 2015
2 parents 3011415 + ecd0c0d commit 0ec78b3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def create_room(self, user_id, room_id, config):
preset_config=preset_config,
invite_list=invite_list,
initial_state=initial_state,
room_alias=room_alias,
)

msg_handler = self.hs.get_handlers().message_handler
Expand Down Expand Up @@ -202,7 +203,7 @@ def create_room(self, user_id, room_id, config):
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()
Expand Down Expand Up @@ -271,6 +272,14 @@ def create(etype, content, **kwargs):

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,
Expand Down

0 comments on commit 0ec78b3

Please sign in to comment.