From c23afed39a3a2796a53caaec19de2d53873956e5 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Mon, 10 Nov 2014 19:34:47 +0000 Subject: [PATCH] Include room membership in room initialSync --- synapse/handlers/message.py | 8 +++++++- tests/rest/test_rooms.py | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index d8764a893..811e280c2 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -336,11 +336,17 @@ class MessageHandler(BaseHandler): feedback=False): yield self.auth.check_joined_room(room_id, user_id) + # TODO: These concurrently state_tuples = yield self.store.get_current_state(room_id) state = [self.hs.serialize_event(x) for x in state_tuples] + member_event = (yield self.store.get_room_member( + user_id=user_id, + room_id=room_id + )) + defer.returnValue({ - #"membership": membership, + "membership": member_event.membership, "room_id": room_id, #"messages": messages, "state": state, diff --git a/tests/rest/test_rooms.py b/tests/rest/test_rooms.py index 1e8b16c36..29f5776f4 100644 --- a/tests/rest/test_rooms.py +++ b/tests/rest/test_rooms.py @@ -1017,6 +1017,7 @@ class RoomInitialSyncTestCase(RestTestCase): self.assertEquals(200, code) self.assertEquals(self.room_id, response["room_id"]) + self.assertEquals("join", response["membership"]) # Room state is easier to assert on if we unpack it into a dict state = {}