summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-09-02 19:23:22 +0100
committerMark Haines <mark.haines@matrix.org>2016-09-02 19:23:22 +0100
commitf2690c64230557701692e16264f2e65a21edab4d (patch)
tree95058af8c81b15c7a661fc794c064b384254cdef
parentMerge pull request #1062 from matrix-org/markjh/direct_to_device_synchrotron (diff)
downloadsynapse-f2690c64230557701692e16264f2e65a21edab4d.tar.xz
Fix membership changes to be idempotent
Diffstat (limited to '')
-rw-r--r--synapse/handlers/room_member.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index 3ba5335af7..ba49075a20 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -85,6 +85,12 @@ class RoomMemberHandler(BaseHandler):
             prev_event_ids=prev_event_ids,
         )
 
+        # Check if this event matches the previous membership event for the user.
+        duplicate = yield msg_handler.deduplicate_state_event(event, context)
+        if duplicate is not None:
+            # Discard the new event since this membership change is a no-op.
+            return
+
         yield msg_handler.handle_new_client_event(
             requester,
             event,