1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2026-01-03 23:22:30 +03:00

Flag the top of the timeline when we hit it

This commit is contained in:
Richard van der Hoff
2016-01-15 17:10:01 +00:00
parent e68ab7d54a
commit fce7248ed5

View File

@@ -2196,6 +2196,13 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) {
var room = self.getRoom(eventTimeline.getRoomId());
var matrixEvents = utils.map(res.chunk, self.getEventMapper());
room.addEventsToTimeline(matrixEvents, backwards, eventTimeline, token);
// if we've hit the end of the timeline, we need to stop trying to
// paginate. We need to keep the 'forwards' token though, to make sure
// we can recover from gappy syncs.
if (backwards && res.end == res.start) {
eventTimeline.setPaginationToken(null, true);
}
return res.end != res.start;
}).finally(function() {
eventTimeline._paginationRequests[dir] = null;