1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-01 21:21:58 +03:00

Fix pagination - set prev_batch at the right time

This commit is contained in:
Kegan Dougal
2015-12-14 12:28:04 +00:00
parent fcf1abb185
commit a00e318d73

View File

@@ -301,9 +301,16 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
// nuke the timeline so we don't get holes
room.timeline = [];
}
// we want to set a new pagination token if this is the first time
// we've made this room or if we're nuking the timeline
var paginationToken = null;
if (joinObj.isBrandNewRoom || joinObj.timeline.limited) {
paginationToken = joinObj.timeline.prev_batch;
}
self._processRoomEvents(
room, stateEvents, timelineEvents,
joinObj.timeline ? joinObj.timeline.prev_batch : null
room, stateEvents, timelineEvents, paginationToken
);
room.addEvents(ephemeralEvents);
room.addEvents(accountDataEvents);