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

Commit

Permalink
Implement MSC 3818
Browse files Browse the repository at this point in the history
Resolves: #11896

Signed-off-by: Aminda Suomalainen <[email protected]>
  • Loading branch information
Mikaela committed May 18, 2022
1 parent 50ae4ea commit b04ec5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/12786.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implement [MSC 3818: Copy room type on upgrade](https://github.com/matrix-org/matrix-spec-proposals/pull/3818)
12 changes: 9 additions & 3 deletions synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,19 @@ async def clone_existing_room(
(EventTypes.PowerLevels, ""),
]

# If the old room was a space, copy over the room type and the rooms in
# the space.
# Copy the room type as per MSC3818 https://github.com/matrix-org/matrix-spec-proposals/pull/3818.
if (
old_room_create_event.content.get(EventContentFields.ROOM_TYPE)
is not None
):
creation_content[EventContentFields.ROOM_TYPE] =
old_room_create_event.content.get(EventContentFields.ROOM_TYPE)

# If the old room was a space, copy over the rooms in the space.
if (
old_room_create_event.content.get(EventContentFields.ROOM_TYPE)
== RoomTypes.SPACE
):
creation_content[EventContentFields.ROOM_TYPE] = RoomTypes.SPACE
types_to_copy.append((EventTypes.SpaceChild, None))

old_room_state_ids = await self.store.get_filtered_current_state_ids(
Expand Down

0 comments on commit b04ec5f

Please sign in to comment.