You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Replace the boolean args on EventTimeline methods with constants
This commit is contained in:
@@ -181,7 +181,7 @@ Room.prototype.resetLiveTimeline = function() {
|
||||
// this method is called by our own constructor.
|
||||
|
||||
// initialise the state in the new timeline from our last known state
|
||||
var evMap = this._liveTimeline.getState(false).events;
|
||||
var evMap = this._liveTimeline.getState(EventTimeline.FORWARDS).events;
|
||||
var events = [];
|
||||
for (var evtype in evMap) {
|
||||
if (!evMap.hasOwnProperty(evtype)) { continue; }
|
||||
@@ -199,8 +199,8 @@ Room.prototype.resetLiveTimeline = function() {
|
||||
// state at the start and end of that timeline. These are more
|
||||
// for backwards-compatibility than anything else.
|
||||
this.timeline = this._liveTimeline.getEvents();
|
||||
this.oldState = this._liveTimeline.getState(true);
|
||||
this.currentState = this._liveTimeline.getState(false);
|
||||
this.oldState = this._liveTimeline.getState(EventTimeline.BACKWARDS);
|
||||
this.currentState = this._liveTimeline.getState(EventTimeline.FORWARDS);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -377,6 +377,11 @@ Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline,
|
||||
return;
|
||||
}
|
||||
|
||||
var direction = toStartOfTimeline ? EventTimeline.BACKWARDS :
|
||||
EventTimeline.FORWARDS;
|
||||
var inverseDirection = toStartOfTimeline ? EventTimeline.FORWARDS :
|
||||
EventTimeline.BACKWARDS;
|
||||
|
||||
// Adding events to timelines can be quite complicated. The following
|
||||
// illustrates some of the corner-cases.
|
||||
//
|
||||
@@ -460,7 +465,7 @@ Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline,
|
||||
continue;
|
||||
}
|
||||
|
||||
var neighbour = timeline.getNeighbouringTimeline(toStartOfTimeline);
|
||||
var neighbour = timeline.getNeighbouringTimeline(direction);
|
||||
if (neighbour) {
|
||||
// this timeline already has a neighbour in the relevant direction;
|
||||
// let's assume the timelines are already correctly linked up, and
|
||||
@@ -486,13 +491,13 @@ Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline,
|
||||
console.info("Already have timeline for " + eventId +
|
||||
" - joining timeline " + timeline + " to " +
|
||||
existingTimeline);
|
||||
timeline.setNeighbouringTimeline(existingTimeline, toStartOfTimeline);
|
||||
existingTimeline.setNeighbouringTimeline(timeline, !toStartOfTimeline);
|
||||
timeline.setNeighbouringTimeline(existingTimeline, direction);
|
||||
existingTimeline.setNeighbouringTimeline(timeline, inverseDirection);
|
||||
timeline = existingTimeline;
|
||||
}
|
||||
|
||||
if (updateToken) {
|
||||
timeline.setPaginationToken(paginationToken, toStartOfTimeline);
|
||||
timeline.setPaginationToken(paginationToken, direction);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -644,7 +649,7 @@ Room.prototype.addEvents = function(events, duplicateStrategy) {
|
||||
// still need to set the right metadata on this event
|
||||
setEventMetadata(
|
||||
events[i],
|
||||
timeline.getState(false),
|
||||
timeline.getState(EventTimeline.FORWARDS),
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user