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

Commit b04ec5f

Browse files
committed
Implement MSC 3818
Resolves: #11896 Signed-off-by: Aminda Suomalainen <[email protected]>
1 parent 50ae4ea commit b04ec5f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

changelog.d/12786.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Implement [MSC 3818: Copy room type on upgrade](https://github.com/matrix-org/matrix-spec-proposals/pull/3818)

synapse/handlers/room.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,19 @@ async def clone_existing_room(
469469
(EventTypes.PowerLevels, ""),
470470
]
471471

472-
# If the old room was a space, copy over the room type and the rooms in
473-
# the space.
472+
# Copy the room type as per MSC3818 https://github.com/matrix-org/matrix-spec-proposals/pull/3818.
473+
if (
474+
old_room_create_event.content.get(EventContentFields.ROOM_TYPE)
475+
is not None
476+
):
477+
creation_content[EventContentFields.ROOM_TYPE] =
478+
old_room_create_event.content.get(EventContentFields.ROOM_TYPE)
479+
480+
# If the old room was a space, copy over the rooms in the space.
474481
if (
475482
old_room_create_event.content.get(EventContentFields.ROOM_TYPE)
476483
== RoomTypes.SPACE
477484
):
478-
creation_content[EventContentFields.ROOM_TYPE] = RoomTypes.SPACE
479485
types_to_copy.append((EventTypes.SpaceChild, None))
480486

481487
old_room_state_ids = await self.store.get_filtered_current_state_ids(

0 commit comments

Comments
 (0)