summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2019-01-30 16:33:51 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2019-01-30 16:33:51 +0000
commitd621c5562ea6bce4fd8282da642b3123ae016d94 (patch)
tree0a833afa853d92655a869cc0cd4cdf9724b3b615 /synapse
parentMerge pull request #4472 from matrix-org/neilj/room_capabilities (diff)
downloadsynapse-d621c5562ea6bce4fd8282da642b3123ae016d94.tar.xz
Copy over non-federatable trait on room upgrade
Diffstat (limited to '')
-rw-r--r--synapse/handlers/room.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 13ba9291b0..c04ba3a0c5 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -263,6 +263,20 @@ class RoomCreationHandler(BaseHandler):
             }
         }
 
+        # Check if old room was non-federatable
+
+        # Get old room's create event
+        old_room_create_event_ids = yield self.store.get_filtered_current_state_ids(
+            old_room_id, StateFilter.from_types(((EventTypes.Create, ""),)),
+        )
+        old_room_create_event_dict = yield self.store.get_events(old_room_create_event_ids.values())
+        old_room_create_event = list(old_room_create_event_dict.values())[0]
+
+        # Check if the create event specified a non-federatable room
+        if old_room_create_event.content.get("m.federate", True) == False:
+            # If so, mark the new room as non-federatable as well
+            creation_content["m.federate"] = False
+
         initial_state = dict()
 
         # Replicate relevant room events