summary refs log tree commit diff
path: root/synapse/handlers/room_member.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2019-11-04 18:08:50 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2019-11-04 18:08:50 +0000
commit0287d033eec86fb7f6bb84f929e756c99caf2113 (patch)
treed2e768244125ff188177fa04c1043e5f12c3e599 /synapse/handlers/room_member.py
parentdocument the REPLICATE command a bit better (#6305) (diff)
downloadsynapse-0287d033eec86fb7f6bb84f929e756c99caf2113.tar.xz
Transfer upgraded rooms on groups
Diffstat (limited to 'synapse/handlers/room_member.py')
-rw-r--r--synapse/handlers/room_member.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index 06d09c2947..01c65ee222 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -514,6 +514,15 @@ class RoomMemberHandler(object):
         if old_room and old_room["is_public"]:
             yield self.store.set_room_is_public(old_room_id, False)
             yield self.store.set_room_is_public(room_id, True)
+            
+        # Check if any groups we own contain the predecessor room
+        local_group_ids = yield self.store.get_local_groups_for_room(old_room_id)
+        for group_id in local_group_ids:
+            # Add new the new room to those groups
+            yield self.store.add_room_to_group(group_id, room_id, old_room["is_public"])
+
+            # Remove the old room from those groups
+            yield self.store.remove_room_from_group(group_id, old_room_id)
 
     @defer.inlineCallbacks
     def copy_user_state_on_room_upgrade(self, old_room_id, new_room_id, user_ids):