Include 'messages' snapshot in room initialSync
This commit is contained in:
parent
31a049eb69
commit
17f977a9de
|
@ -308,10 +308,29 @@ class MessageHandler(BaseHandler):
|
||||||
room_id=room_id
|
room_id=room_id
|
||||||
))
|
))
|
||||||
|
|
||||||
|
now_token = yield self.hs.get_event_sources().get_current_token()
|
||||||
|
|
||||||
|
limit = pagin_config.limit if pagin_config else None
|
||||||
|
if limit is None:
|
||||||
|
limit = 10
|
||||||
|
|
||||||
|
messages, token = yield self.store.get_recent_events_for_room(
|
||||||
|
room_id,
|
||||||
|
limit=limit,
|
||||||
|
end_token=now_token.room_key,
|
||||||
|
)
|
||||||
|
|
||||||
|
start_token = now_token.copy_and_replace("room_key", token[0])
|
||||||
|
end_token = now_token.copy_and_replace("room_key", token[1])
|
||||||
|
|
||||||
defer.returnValue({
|
defer.returnValue({
|
||||||
"membership": member_event.membership,
|
"membership": member_event.membership,
|
||||||
"room_id": room_id,
|
"room_id": room_id,
|
||||||
#"messages": messages,
|
"messages": {
|
||||||
|
"chunk": [self.hs.serialize_event(m) for m in messages],
|
||||||
|
"start": start_token.to_string(),
|
||||||
|
"end": end_token.to_string(),
|
||||||
|
},
|
||||||
"state": state,
|
"state": state,
|
||||||
#"presence": presence
|
#"presence": presence
|
||||||
})
|
})
|
||||||
|
|
|
@ -1050,6 +1050,10 @@ class RoomInitialSyncTestCase(RestTestCase):
|
||||||
|
|
||||||
self.assertTrue("m.room.create" in state)
|
self.assertTrue("m.room.create" in state)
|
||||||
|
|
||||||
|
self.assertTrue("messages" in response)
|
||||||
|
self.assertTrue("chunk" in response["messages"])
|
||||||
|
self.assertTrue("end" in response["messages"])
|
||||||
|
|
||||||
# (code, response) = yield self.mock_resource.trigger("GET", path, None)
|
# (code, response) = yield self.mock_resource.trigger("GET", path, None)
|
||||||
# self.assertEquals(200, code, msg=str(response))
|
# self.assertEquals(200, code, msg=str(response))
|
||||||
# self.assert_dict(json.loads(content), response)
|
# self.assert_dict(json.loads(content), response)
|
||||||
|
|
Loading…
Reference in New Issue