summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-12-01 16:03:08 +0000
committerMark Haines <mark.haines@matrix.org>2015-12-01 16:03:08 +0000
commit3d3da2b4609d02bbbb276313fd6b2cc8069e213d (patch)
treecfc19afb2b435d7e04dc393d62381baf0686d292 /synapse/handlers
parentAdd options to definitions.py to fetch referrers and to output dot (diff)
downloadsynapse-3d3da2b4609d02bbbb276313fd6b2cc8069e213d.tar.xz
Only fire user_joined_room on the distributor if the user has actually joined the room
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/room.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 023b4001b8..cb6ac37758 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -517,10 +517,12 @@ class RoomMemberHandler(BaseHandler):
                 do_auth=do_auth,
             )
 
-        user = UserID.from_string(event.user_id)
-        yield self.distributor.fire(
-            "user_joined_room", user=user, room_id=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.user_id)
+            yield self.distributor.fire(
+                "user_joined_room", user=user, room_id=room_id
+            )
 
     @defer.inlineCallbacks
     def get_inviter(self, event):