0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-17 17:23:50 +01:00

Transfer bans on room upgrade

This commit is contained in:
Andrew Morgan 2019-02-14 13:43:50 +00:00
parent c6e75c9f2d
commit 9caab0c364

View file

@ -285,6 +285,7 @@ class RoomCreationHandler(BaseHandler):
(EventTypes.RoomAvatar, ""), (EventTypes.RoomAvatar, ""),
(EventTypes.Encryption, ""), (EventTypes.Encryption, ""),
(EventTypes.ServerACL, ""), (EventTypes.ServerACL, ""),
(EventTypes.Member, None),
) )
old_room_state_ids = yield self.store.get_filtered_current_state_ids( 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): for k, old_event_id in iteritems(old_room_state_ids):
old_event = old_room_state_events.get(old_event_id) old_event = old_room_state_events.get(old_event_id)
if old_event: 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 initial_state[k] = old_event.content
yield self._send_events_for_new_room( yield self._send_events_for_new_room(