Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Move member event processing and changelog fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Feb 18, 2019
1 parent 9154210 commit f8b9ca5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
File renamed without changes.
16 changes: 7 additions & 9 deletions synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ def clone_existing_room(
(EventTypes.RoomAvatar, ""),
(EventTypes.Encryption, ""),
(EventTypes.ServerACL, ""),
(EventTypes.Member, None),
)

old_room_state_ids = yield self.store.get_filtered_current_state_ids(
Expand All @@ -294,15 +293,9 @@ def clone_existing_room(
# map from event_id to BaseEvent
old_room_state_events = yield self.store.get_events(old_room_state_ids.values())

member_events = []
for k, old_event_id in iteritems(old_room_state_ids):
old_event = old_room_state_events.get(old_event_id)
if old_event:
# Do membership events later
if ("membership" in old_event.content):
member_events.append(old_event)
continue

initial_state[k] = old_event.content

yield self._send_events_for_new_room(
Expand All @@ -319,9 +312,14 @@ def clone_existing_room(
)

# Transfer membership events
for old_event in member_events:
old_room_member_state_ids = yield self.store.get_filtered_current_state_ids(
old_room_id, StateFilter.from_types([(EventTypes.Member, None)]),
)

# map from event_id to BaseEvent
old_room_member_state_events = yield self.store.get_events(old_room_member_state_ids.values())
for k, old_event in iteritems(old_room_member_state_events):
# Only transfer ban events
logger.info("Event type: " + str(old_event.content))
if ("membership" in old_event.content and
old_event.content["membership"] == "ban"):
yield self.room_member_handler.update_membership(
Expand Down

0 comments on commit f8b9ca5

Please sign in to comment.