mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 18:30:24 +00:00
Only fire user_joined_room if the membership has changed
This commit is contained in:
parent
f73ea0bda2
commit
ed0f79bdc5
1 changed files with 8 additions and 3 deletions
|
@ -233,10 +233,15 @@ class FederationHandler(BaseHandler):
|
||||||
|
|
||||||
if event.type == EventTypes.Member:
|
if event.type == EventTypes.Member:
|
||||||
if event.membership == Membership.JOIN:
|
if event.membership == Membership.JOIN:
|
||||||
user = UserID.from_string(event.state_key)
|
context = yield self.state_handler.compute_event_context(
|
||||||
yield self.distributor.fire(
|
event, old_state=state, outlier=event.internal_metadata.is_outlier()
|
||||||
"user_joined_room", user=user, room_id=event.room_id
|
|
||||||
)
|
)
|
||||||
|
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
|
@defer.inlineCallbacks
|
||||||
def _filter_events_for_server(self, server_name, room_id, events):
|
def _filter_events_for_server(self, server_name, room_id, events):
|
||||||
|
|
Loading…
Reference in a new issue