From 269f80bf8ecc4a89c2bb71f0872893bb53a252ca Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Mon, 10 Nov 2014 19:02:19 +0000 Subject: Have room initialSync return the room's room_id --- synapse/rest/room.py | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'synapse/rest') 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): -- cgit 1.4.1 From 75e95c45a2da90528261c028e97e60a493106c5a Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Tue, 18 Nov 2014 16:02:44 +0000 Subject: Rename message handler's new snapshot_room to room_initial_sync() as that better suits its purpose --- synapse/handlers/message.py | 2 +- synapse/rest/room.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'synapse/rest') diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 21f9df30ec..081030dbb8 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -295,7 +295,7 @@ class MessageHandler(BaseHandler): defer.returnValue(ret) @defer.inlineCallbacks - def snapshot_room(self, user_id, room_id, pagin_config=None, + def room_initial_sync(self, user_id, room_id, pagin_config=None, feedback=False): yield self.auth.check_joined_room(room_id, user_id) diff --git a/synapse/rest/room.py b/synapse/rest/room.py index 393d6284f5..e656dd3f35 100644 --- a/synapse/rest/room.py +++ b/synapse/rest/room.py @@ -362,7 +362,7 @@ class RoomInitialSyncRestServlet(RestServlet): @defer.inlineCallbacks def on_GET(self, request, room_id): user = yield self.auth.get_user_by_req(request) - events = yield self.handlers.message_handler.snapshot_room( + events = yield self.handlers.message_handler.room_initial_sync( room_id=room_id, user_id=user.to_string(), ) -- cgit 1.4.1 From 88dfa7baa6b5ed995954021328ecc4927693504a Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Tue, 18 Nov 2014 16:34:43 +0000 Subject: Ensure to parse a real pagination config object out of room initialSync request and pass it on --- synapse/rest/room.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'synapse/rest') diff --git a/synapse/rest/room.py b/synapse/rest/room.py index e656dd3f35..17322ee9bb 100644 --- a/synapse/rest/room.py +++ b/synapse/rest/room.py @@ -362,11 +362,13 @@ class RoomInitialSyncRestServlet(RestServlet): @defer.inlineCallbacks def on_GET(self, request, room_id): user = yield self.auth.get_user_by_req(request) - events = yield self.handlers.message_handler.room_initial_sync( + pagination_config = PaginationConfig.from_request(request) + content = yield self.handlers.message_handler.room_initial_sync( room_id=room_id, user_id=user.to_string(), + pagin_config=pagination_config, ) - defer.returnValue((200, events)) + defer.returnValue((200, content)) class RoomTriggerBackfill(RestServlet): -- cgit 1.4.1