summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAminda Suomalainen <suomalainen+git@mikaela.info>2022-05-19 14:28:10 +0300
committerGitHub <noreply@github.com>2022-05-19 12:28:10 +0100
commitd25935cd3d92a77a43719df8f6763be0cbcf665b (patch)
tree508cd50cf0932792a341bc3ccc34807c956b9bc0 /synapse
parentAdd missing user directory search endpoint to the generic worker documentatio... (diff)
downloadsynapse-d25935cd3d92a77a43719df8f6763be0cbcf665b.tar.xz
Implement MSC3818: copy room type on upgrade (#12786)
Resolves: #11896

Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/room.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py

index 53569e5212..b7d64a2f5a 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py
@@ -469,14 +469,14 @@ class RoomCreationHandler: (EventTypes.PowerLevels, ""), ] - # If the old room was a space, copy over the room type and 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)) + # Copy the room type as per MSC3818. + room_type = old_room_create_event.content.get(EventContentFields.ROOM_TYPE) + if room_type is not None: + creation_content[EventContentFields.ROOM_TYPE] = room_type + + # If the old room was a space, copy over the rooms in the space. + if room_type == RoomTypes.SPACE: + types_to_copy.append((EventTypes.SpaceChild, None)) old_room_state_ids = await self.store.get_filtered_current_state_ids( old_room_id, StateFilter.from_types(types_to_copy)