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

PR feedback, rename method

This commit is contained in:
Bruno Windels
2018-08-03 14:44:51 +02:00
parent 5285b22a76
commit 7aa0dcc89f
2 changed files with 3 additions and 4 deletions

View File

@@ -2014,7 +2014,7 @@ MatrixClient.prototype.scrollback = function(room, limit, callback) {
const matrixEvents = utils.map(res.chunk, _PojoToMatrixEventMapper(self));
if (res.state) {
const stateEvents = utils.map(res.state, _PojoToMatrixEventMapper(self));
room.currentState.prependStateEvents(stateEvents);
room.currentState.setUnknownStateEvents(stateEvents);
}
room.addEventsToTimeline(matrixEvents, true, room.getLiveTimeline());
room.oldState.paginationToken = res.end;

View File

@@ -263,14 +263,13 @@ RoomState.prototype.clone = function() {
};
/**
* Add previously unknown state events just before
* prepending events to the timeline.
* Add previously unknown state events.
* When lazy loading members while back-paginating,
* the relevant room state for the timeline chunk at the end
* of the chunk can be set with this method.
* @param {MatrixEvent[]} events state events to prepend
*/
RoomState.prototype.prependStateEvents = function(events) {
RoomState.prototype.setUnknownStateEvents = function(events) {
const unknownStateEvents = events.filter((event) => {
return this.events[event.getType()] === undefined ||
this.events[event.getType()][event.getStateKey()] === undefined;