1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-18 05:42:00 +03:00

Modify how detection of the end of pagination is done

Synapse may filter down the events resulting in < 'limit' events being
returned *but it still has more events*. Change the check to see if the
request returned an empty array instead. This may add an extra HTTP hit.
This commit is contained in:
Kegan Dougal
2015-11-05 13:26:16 +00:00
parent bc512a6e4c
commit 16278892d8

View File

@@ -1638,7 +1638,7 @@ MatrixClient.prototype.scrollback = function(room, limit, callback) {
var matrixEvents = utils.map(res.chunk, _PojoToMatrixEventMapper(self));
room.addEventsToTimeline(matrixEvents, true);
room.oldState.paginationToken = res.end;
if (res.chunk.length < limit) {
if (res.chunk.length === 0) {
room.oldState.paginationToken = null;
}
self.store.storeEvents(room, matrixEvents, res.end, true);