summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-20 11:50:16 +0100
committerErik Johnston <erik@matrix.org>2014-08-20 11:53:57 +0100
commit849627b82e751071f80c96f62c9e59a2565cd85c (patch)
tree903767491ac358cf45f5aebb82cb199edcfc3b48
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-849627b82e751071f80c96f62c9e59a2565cd85c.tar.xz
Don't generate room membership messages. Include previous state of in membership messages.
Diffstat (limited to '')
-rw-r--r--synapse/handlers/room.py17
-rw-r--r--tests/rest/test_rooms.py7
2 files changed, 16 insertions, 8 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 40867ae2e0..7ab881847d 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -506,18 +506,21 @@ class RoomMemberHandler(BaseHandler):
             SynapseError if there was a problem changing the membership.
         """
 
-        # broadcast_msg = False
+        broadcast_msg = False
 
         prev_state = yield self.store.get_room_member(
             event.target_user_id, event.room_id
         )
 
-        if prev_state and prev_state.membership == event.membership:
-            # treat this event as a NOOP.
-            if do_auth:  # This is mainly to fix a unit test.
-                yield self.auth.check(event, raises=True)
-            defer.returnValue({})
-            return
+        if prev_state:
+            event.content["prev"] = prev_state.membership
+
+#        if prev_state and prev_state.membership == event.membership:
+#            # treat this event as a NOOP.
+#            if do_auth:  # This is mainly to fix a unit test.
+#                yield self.auth.check(event, raises=True)
+#            defer.returnValue({})
+#            return
 
         room_id = event.room_id
 
diff --git a/tests/rest/test_rooms.py b/tests/rest/test_rooms.py
index e873181044..a9b66df912 100644
--- a/tests/rest/test_rooms.py
+++ b/tests/rest/test_rooms.py
@@ -794,7 +794,12 @@ class RoomMemberStateTestCase(RestTestCase):
 
         (code, response) = yield self.mock_resource.trigger("GET", path, None)
         self.assertEquals(200, code, msg=str(response))
-        self.assertEquals(json.loads(content), response)
+
+        expected_response = {
+            "membership": Membership.JOIN,
+            "prev": Membership.JOIN,
+        }
+        self.assertEquals(expected_response, response)
 
     @defer.inlineCallbacks
     def test_rooms_members_other(self):