diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-12-01 19:46:15 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-12-01 19:46:15 +0000 |
commit | ed0f79bdc5e507705655fa380394b8f4328f90e1 (patch) | |
tree | 36471d9f2ad80a4abe5eb6316973d34843f66fff /synapse | |
parent | Merge branch 'develop' into markjh/edu_frequency (diff) | |
download | synapse-ed0f79bdc5e507705655fa380394b8f4328f90e1.tar.xz |
Only fire user_joined_room if the membership has changed
Diffstat (limited to '')
-rw-r--r-- | synapse/handlers/federation.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index c1bce07e31..e5fb1dd3c9 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -233,10 +233,15 @@ class FederationHandler(BaseHandler): if event.type == EventTypes.Member: if event.membership == Membership.JOIN: - user = UserID.from_string(event.state_key) - yield self.distributor.fire( - "user_joined_room", user=user, room_id=event.room_id + context = yield self.state_handler.compute_event_context( + event, old_state=state, outlier=event.internal_metadata.is_outlier() ) + prev_state = context.current_state.get((event.type, event.state_key)) + if not prev_state or prev_state.membership != Membership.JOIN: + user = UserID.from_string(event.state_key) + yield self.distributor.fire( + "user_joined_room", user=user, room_id=event.room_id + ) @defer.inlineCallbacks def _filter_events_for_server(self, server_name, room_id, events): |