diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index 3c1d8236..c5fc98a2 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -337,12 +337,12 @@ export class Timeline { } /** - * Fetches an entry with the given event-id from remoteEntries or contextEntriesNotInTimeline. + * Fetches an entry with the given event-id from localEntries, remoteEntries or contextEntriesNotInTimeline. * @param {string} eventId event-id of the entry * @returns entry if found, undefined otherwise */ _findLoadedEventById(eventId) { - return this.getByEventId(eventId) ?? this._contextEntriesNotInTimeline.get(eventId); + return this.getFromAllEntriesById(eventId) ?? this._contextEntriesNotInTimeline.get(eventId); } async _getEventFromStorage(eventId) { @@ -421,6 +421,16 @@ export class Timeline { return null; } + getFromAllEntriesById(eventId) { + for (let i = 0; i < this.entries.length; i += 1) { + const entry = this.entries.get(i); + if (entry.id === eventId) { + return entry; + } + } + return null; + } + /** @public */ get entries() { return this._allEntries;