0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-18 18:34:11 +01:00

Merge pull request #410 from matrix-org/markjh/edu_frequency

Only fire user_joined_room if the user has actually joined.
This commit is contained in:
Mark Haines 2015-12-02 13:17:15 +00:00
commit 58d0927767
2 changed files with 15 additions and 5 deletions

View file

@ -177,7 +177,7 @@ class FederationHandler(BaseHandler):
) )
try: try:
_, event_stream_id, max_stream_id = yield self._handle_new_event( context, event_stream_id, max_stream_id = yield self._handle_new_event(
origin, origin,
event, event,
state=state, state=state,
@ -234,6 +234,11 @@ class FederationHandler(BaseHandler):
if event.type == EventTypes.Member: if event.type == EventTypes.Member:
if event.membership == Membership.JOIN: if event.membership == Membership.JOIN:
prev_state = context.current_state.get((event.type, event.state_key))
if not prev_state or prev_state.membership != Membership.JOIN:
# Only fire user_joined_room if the user has acutally
# joined the room. Don't bother if the user is just
# changing their profile info.
user = UserID.from_string(event.state_key) user = UserID.from_string(event.state_key)
yield user_joined_room(self.distributor, user, event.room_id) yield user_joined_room(self.distributor, user, event.room_id)

View file

@ -525,6 +525,11 @@ class RoomMemberHandler(BaseHandler):
do_auth=do_auth, do_auth=do_auth,
) )
prev_state = context.current_state.get((event.type, event.state_key))
if not prev_state or prev_state.membership != Membership.JOIN:
# Only fire user_joined_room if the user has acutally joined the
# room. Don't bother if the user is just changing their profile
# info.
user = UserID.from_string(event.user_id) user = UserID.from_string(event.user_id)
yield user_joined_room(self.distributor, user, room_id) yield user_joined_room(self.distributor, user, room_id)