From 24b56d728f95a58dca4ad8cf8e0bf8c7342bf1ce Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Thu, 19 May 2022 13:26:30 +0300 Subject: [PATCH] feedback from review Signed-off-by: Aminda Suomalainen --- synapse/handlers/room.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 7fab4a9617c6..b2403545d9fb 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -469,18 +469,16 @@ async def clone_existing_room( (EventTypes.PowerLevels, ""), ] - # 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: + # 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 ] = 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 - ): - types_to_copy.append((EventTypes.SpaceChild, None)) + # 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)