1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

initial PR fixes

This commit is contained in:
Matthew Hodgson
2016-09-08 17:51:14 +01:00
parent 13c186dfbe
commit 7dfc4a404c
2 changed files with 17 additions and 18 deletions

View File

@@ -70,7 +70,7 @@ function EventTimelineSet(roomId, room, opts) {
this._timelines = [this._liveTimeline]; this._timelines = [this._liveTimeline];
this._eventIdToTimeline = {}; this._eventIdToTimeline = {};
this._filter = opts.filter; this._filter = opts.filter || null;
} }
utils.inherits(EventTimelineSet, EventEmitter); 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.
*/

View File

@@ -223,10 +223,10 @@ Room.prototype._fixUpLegacyTimelineFields = function() {
// and this.oldState and this.currentState as references to the // and this.oldState and this.currentState as references to the
// state at the start and end of that timeline. These are more // state at the start and end of that timeline. These are more
// for backwards-compatibility than anything else. // for backwards-compatibility than anything else.
this.timeline = this.getUnfilteredTimelineSet().getLiveTimeline().getEvents(); this.timeline = this.getLiveTimeline().getEvents();
this.oldState = this.getUnfilteredTimelineSet().getLiveTimeline() this.oldState = this.getLiveTimeline()
.getState(EventTimeline.BACKWARDS); .getState(EventTimeline.BACKWARDS);
this.currentState = this.getUnfilteredTimelineSet().getLiveTimeline() this.currentState = this.getLiveTimeline()
.getState(EventTimeline.FORWARDS); .getState(EventTimeline.FORWARDS);
}; };
@@ -477,7 +477,7 @@ Room.prototype.getOrCreateFilteredTimelineSet = function(filter) {
// may have grown huge and so take a long time to filter. // may have grown huge and so take a long time to filter.
// see https://github.com/vector-im/vector-web/issues/2109 // see https://github.com/vector-im/vector-web/issues/2109
var unfilteredLiveTimeline = this.getUnfilteredTimelineSet().getLiveTimeline(); var unfilteredLiveTimeline = this.getLiveTimeline();
unfilteredLiveTimeline.getEvents().forEach(function(event) { unfilteredLiveTimeline.getEvents().forEach(function(event) {
timelineSet.addLiveEvent(event); timelineSet.addLiveEvent(event);
@@ -1358,3 +1358,15 @@ module.exports = Room;
* *
* @param {EventStatus} oldStatus The previous event status. * @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.
*/