summary refs log tree commit diff
path: root/synapse/handlers/room.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2019-02-14 13:43:50 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2019-02-18 13:52:51 +0000
commit9caab0c364e4c79c76cc0816a598ad6174da364b (patch)
treea8133381b4b75f48e9461b0d9a79ceedb10335b7 /synapse/handlers/room.py
parentMerge pull request #4450 from 14mRh4X0r/fix-dependency-message (diff)
downloadsynapse-9caab0c364e4c79c76cc0816a598ad6174da364b.tar.xz
Transfer bans on room upgrade
Diffstat (limited to 'synapse/handlers/room.py')
-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 f9af1f0046..924880d522 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -285,6 +285,7 @@ class RoomCreationHandler(BaseHandler):
             (EventTypes.RoomAvatar, ""),
             (EventTypes.Encryption, ""),
             (EventTypes.ServerACL, ""),
+            (EventTypes.Member, None),
         )
 
         old_room_state_ids = yield self.store.get_filtered_current_state_ids(
@@ -296,6 +297,19 @@ class RoomCreationHandler(BaseHandler):
         for k, old_event_id in iteritems(old_room_state_ids):
             old_event = old_room_state_events.get(old_event_id)
             if old_event:
+
+                # Only transfer ban membership events
+                if ("membership" in old_event.content and
+                        old_event.content["membership"] == "ban"):
+                    yield self.room_member_handler.update_membership(
+                        requester,
+                        UserID.from_string(old_event['state_key']),
+                        room_id,
+                        "ban",
+                        ratelimit=False,
+                        content=old_event.content,
+                    )
+
                 initial_state[k] = old_event.content
 
         yield self._send_events_for_new_room(