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

make most things work other than Room.timeline firing

This commit is contained in:
Matthew Hodgson
2016-08-30 01:11:47 +01:00
parent 58031ab21d
commit 7514aea813
2 changed files with 34 additions and 6 deletions

View File

@@ -162,7 +162,8 @@ function Room(roomId, opts) {
// all our per-room timeline lists. the first one is the unfiltered ones;
// the subsequent ones are the filtered ones in no particular order.
this._timelineLists = [ new EventTimelineList(roomId, opts) ];
this._timelineLists = [ new EventTimelineList(roomId, this, opts) ];
this._fixUpLegacyTimelineFields();
// any filtered timeline lists we're maintaining for this room
@@ -242,6 +243,28 @@ Room.prototype._fixUpLegacyTimelineFields = function() {
this.currentState = this._timelineLists[0].getLiveTimeline().getState(EventTimeline.FORWARDS);
};
/**
* Get the timeline which contains the given event from the unfiltered set, if any
*
* @param {string} eventId event ID to look for
* @return {?module:models/event-timeline~EventTimeline} timeline containing
* the given event, or null if unknown
*/
Room.prototype.getTimelineForEvent = function(eventId) {
return this._timelineLists[0].getTimelineForEvent(eventId);
};
/**
* Get an event which is stored in our unfiltered timeline set
*
* @param {string} eventId event ID to look for
* @return {?module:models/event~MatrixEvent} the given event, or undefined if unknown
*/
Room.prototype.findEventById = function(eventId) {
return this._timelineLists[0].findEventById(eventId);
}
/**
* Get one of the notification counts for this room
* @param {String} type The type of notification count to get. default: 'total'
@@ -356,7 +379,10 @@ Room.prototype.getCanonicalAlias = function() {
Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline,
timeline, paginationToken) {
for (var i = 0; i < this._timelineLists.length; i++) {
this._timelineLists[0]
this._timelineLists[0].addEventsToTimeline(
events, toStartOfTimeline,
timeline, paginationToken
);
}
};
@@ -423,7 +449,7 @@ Room.prototype.addEventsToTimeline = function(events, toStartOfTimeline,
*/
Room.prototype.addFilteredTimelineList = function(filter) {
var timelineList = new EventTimelineList(
this.roomId, {
this.roomId, this, {
filter: filter,
}
);