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

make the tests pass again

This commit is contained in:
Matthew Hodgson
2016-08-30 23:34:11 +01:00
parent e18b446190
commit d25d60f0f0
4 changed files with 61 additions and 52 deletions

View File

@@ -256,6 +256,15 @@ Room.prototype.getTimelineForEvent = function(eventId) {
return this._timelineLists[0].getTimelineForEvent(eventId);
};
/**
* Add a new timeline to this room's unfiltered timeline list
*
* @return {module:models/event-timeline~EventTimeline} newly-created timeline
*/
Room.prototype.addTimeline = function() {
return this._timelineLists[0].addTimeline();
};
/**
* Get an event which is stored in our unfiltered timeline set
*
@@ -264,7 +273,7 @@ Room.prototype.getTimelineForEvent = function(eventId) {
*/
Room.prototype.findEventById = function(eventId) {
return this._timelineLists[0].findEventById(eventId);
}
};
/**
* Get one of the notification counts for this room
@@ -578,7 +587,7 @@ Room.prototype.addPendingEvent = function(event, txnId) {
// call setEventMetadata to set up event.sender etc
// as event is shared over all timelinelists, we set up its metadata based
// on the unfiltered timelineList.
this._timelineLists[0].setEventMetadata(
EventTimeline.setEventMetadata(
event,
this._timelineLists[0].getLiveTimeline().getState(EventTimeline.FORWARDS),
false
@@ -696,7 +705,7 @@ Room.prototype.updatePendingEvent = function(event, newStatus, newEventId) {
// SENT races against /sync, so we have to special-case it.
if (newStatus == EventStatus.SENT) {
var timeline = this._eventIdToTimeline[newEventId];
var timeline = this._timelineLists[0].eventIdToTimeline(newEventId);
if (timeline) {
// we've already received the event via the event stream.
// nothing more to do here.
@@ -727,10 +736,8 @@ Room.prototype.updatePendingEvent = function(event, newStatus, newEventId) {
// if the event was already in the timeline (which will be the case if
// opts.pendingEventOrdering==chronological), we need to update the
// timeline map.
var existingTimeline = this._eventIdToTimeline[oldEventId];
if (existingTimeline) {
delete this._eventIdToTimeline[oldEventId];
this._eventIdToTimeline[newEventId] = existingTimeline;
for (var i = 0; i < this._timelineLists.length; i++) {
this._timelineLists[i].replaceEventId(oldEventId, newEventId);
}
}
else if (newStatus == EventStatus.CANCELLED) {