1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Review comments

This commit is contained in:
Kegan Dougal
2017-03-22 15:13:21 +00:00
parent ccbc0b79b8
commit 14727d75ac

View File

@@ -154,10 +154,11 @@ EventTimelineSet.prototype.replaceEventId = function(oldEventId, newEventId) {
* @fires module:client~MatrixClient#event:"Room.timelineReset"
*/
EventTimelineSet.prototype.resetLiveTimeline = function(backPaginationToken, flush) {
let newTimeline;
// if timeline support is disabled, forget about the old timelines
const resetAllTimelines = !this._timelineSupport || flush;
if (!this._timelineSupport || flush) {
// if timeline support is disabled, forget about the old timelines
let newTimeline;
if (resetAllTimelines) {
newTimeline = new EventTimeline(this);
this._timelines = [newTimeline];
this._eventIdToTimeline = {};
@@ -187,7 +188,7 @@ EventTimelineSet.prototype.resetLiveTimeline = function(backPaginationToken, flu
newTimeline.setPaginationToken(backPaginationToken, EventTimeline.BACKWARDS);
this._liveTimeline = newTimeline;
this.emit("Room.timelineReset", this.room, this, flush);
this.emit("Room.timelineReset", this.room, this, resetAllTimelines);
};
/**
@@ -655,6 +656,5 @@ module.exports = EventTimelineSet;
* @event module:client~MatrixClient#"Room.timelineReset"
* @param {Room} room The room whose live timeline was reset, if any
* @param {EventTimelineSet} timelineSet timelineSet room whose live timeline was reset
* @param {boolean} resetAll The return value for canResetEntireTimeline() for this room.
* If true, ALL timeline sets for this room will be reset.
* @param {boolean} resetAllTimelines True if all timelines were reset.
*/