diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-11-10 19:02:19 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-11-10 19:02:19 +0000 |
commit | 269f80bf8ecc4a89c2bb71f0872893bb53a252ca (patch) | |
tree | 5fd5bae78cabeec6604ffa6b0c0d76ac81774b8a /synapse | |
parent | Initial (empty) test that room initialSync at least returns 200 OK (diff) | |
download | synapse-269f80bf8ecc4a89c2bb71f0872893bb53a252ca.tar.xz |
Have room initialSync return the room's room_id
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/message.py | 11 | ||||
-rw-r--r-- | synapse/rest/room.py | 27 |
2 files changed, 17 insertions, 21 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 72894869ea..bb1290fd05 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -331,4 +331,15 @@ class MessageHandler(BaseHandler): defer.returnValue(ret) + @defer.inlineCallbacks + def snapshot_room(self, user_id, room_id, pagin_config=None, + feedback=False): + yield self.auth.check_joined_room(room_id, user_id) + defer.returnValue({ + #"membership": membership, + "room_id": room_id, + #"messages": messages, + #"state": state, + #"presence": presence, + }) diff --git a/synapse/rest/room.py b/synapse/rest/room.py index 7724967061..b762de1cb3 100644 --- a/synapse/rest/room.py +++ b/synapse/rest/room.py @@ -353,27 +353,12 @@ class RoomInitialSyncRestServlet(RestServlet): @defer.inlineCallbacks def on_GET(self, request, room_id): - yield self.auth.get_user_by_req(request) - # TODO: Get all the initial sync data for this room and return in the - # same format as initial sync, that is: - # { - # membership: join, - # messages: [ - # chunk: [ msg events ], - # start: s_tok, - # end: e_tok - # ], - # room_id: foo, - # state: [ - # { state event } , { state event } - # ] - # } - # Probably worth keeping the keys room_id and membership for parity - # with /initialSync even though they must be joined to sync this and - # know the room ID, so clients can reuse the same code (room_id and - # membership are MANDATORY for /initialSync, so the code will expect - # it to be there) - defer.returnValue((200, {})) + user = yield self.auth.get_user_by_req(request) + events = yield self.handlers.message_handler.snapshot_room( + room_id=room_id, + user_id=user.to_string(), + ) + defer.returnValue((200, events)) class RoomTriggerBackfill(RestServlet): |