diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2019-02-18 14:02:09 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2019-02-18 14:02:09 +0000 |
commit | 915421065b6738c78779d40994cb2dd33d618b9b (patch) | |
tree | 656a3a3ea56ff2c8bef211c664fdda9a69028817 /synapse | |
parent | Add changelog (diff) | |
download | synapse-915421065b6738c78779d40994cb2dd33d618b9b.tar.xz |
Membership events are done later
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/room.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 924880d522..2d24c115b6 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -294,21 +294,14 @@ class RoomCreationHandler(BaseHandler): # 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: - - # 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, - ) + # Do membership events later + if ("membership" in old_event.content): + member_events.append(old_event) + continue initial_state[k] = old_event.content @@ -325,6 +318,21 @@ class RoomCreationHandler(BaseHandler): creation_content=creation_content, ) + # Transfer membership events + for old_event in member_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( + requester, + UserID.from_string(old_event['state_key']), + new_room_id, + "ban", + ratelimit=False, + content=old_event.content, + ) + # XXX invites/joins # XXX 3pid invites |