diff --git a/lib/models/event-timeline-set.js b/lib/models/event-timeline-set.js index abc1d9386..4b9a80e4d 100644 --- a/lib/models/event-timeline-set.js +++ b/lib/models/event-timeline-set.js @@ -70,7 +70,7 @@ function EventTimelineSet(roomId, room, opts) { this._timelines = [this._liveTimeline]; this._eventIdToTimeline = {}; - this._filter = opts.filter; + this._filter = opts.filter || null; } utils.inherits(EventTimelineSet, EventEmitter); @@ -639,16 +639,3 @@ module.exports = EventTimelineSet; * } * }); */ - -/** - * Fires whenever the live timeline in a room is reset. - * - * When we get a 'limited' sync (for example, after a network outage), we reset - * the live timeline to be empty before adding the recent events to the new - * timeline. This event is fired after the timeline is reset, and before the - * new events are added. - * - * @event module:client~MatrixClient#"Room.timelineReset" - * @param {Room} room The room whose live timeline was reset. - */ - diff --git a/lib/models/room.js b/lib/models/room.js index f7379414a..621ac8493 100644 --- a/lib/models/room.js +++ b/lib/models/room.js @@ -223,10 +223,10 @@ Room.prototype._fixUpLegacyTimelineFields = function() { // and this.oldState and this.currentState as references to the // state at the start and end of that timeline. These are more // for backwards-compatibility than anything else. - this.timeline = this.getUnfilteredTimelineSet().getLiveTimeline().getEvents(); - this.oldState = this.getUnfilteredTimelineSet().getLiveTimeline() + this.timeline = this.getLiveTimeline().getEvents(); + this.oldState = this.getLiveTimeline() .getState(EventTimeline.BACKWARDS); - this.currentState = this.getUnfilteredTimelineSet().getLiveTimeline() + this.currentState = this.getLiveTimeline() .getState(EventTimeline.FORWARDS); }; @@ -477,7 +477,7 @@ Room.prototype.getOrCreateFilteredTimelineSet = function(filter) { // may have grown huge and so take a long time to filter. // see https://github.com/vector-im/vector-web/issues/2109 - var unfilteredLiveTimeline = this.getUnfilteredTimelineSet().getLiveTimeline(); + var unfilteredLiveTimeline = this.getLiveTimeline(); unfilteredLiveTimeline.getEvents().forEach(function(event) { timelineSet.addLiveEvent(event); @@ -1358,3 +1358,15 @@ module.exports = Room; * * @param {EventStatus} oldStatus The previous event status. */ + +/** + * Fires whenever the live timeline in a room is reset. + * + * When we get a 'limited' sync (for example, after a network outage), we reset + * the live timeline to be empty before adding the recent events to the new + * timeline. This event is fired after the timeline is reset, and before the + * new events are added. + * + * @event module:client~MatrixClient#"Room.timelineReset" + * @param {Room} room The room whose live timeline was reset. + */