From 06864a65b76d33a77c91ceb1f3d1673bf20a77bb Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 7 Dec 2021 13:00:10 +0530 Subject: [PATCH] Add contextEventId --- src/matrix/room/timeline/Timeline.js | 4 ++-- src/matrix/room/timeline/entries/EventEntry.js | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index 2baa0c80..1488a307 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -245,9 +245,9 @@ export class Timeline { } async _loadRelatedEvents(entries) { - const filteredEntries = entries.filter(e => !!e.relation); + const filteredEntries = entries.filter(e => !!e.contextEventId); for (const entry of filteredEntries) { - const id = entry.relatedEventId; + const id = entry.contextEventId; let contextEvent; // find in remote events contextEvent = this.getByEventId(id); diff --git a/src/matrix/room/timeline/entries/EventEntry.js b/src/matrix/room/timeline/entries/EventEntry.js index 229c6940..906bd108 100644 --- a/src/matrix/room/timeline/entries/EventEntry.js +++ b/src/matrix/room/timeline/entries/EventEntry.js @@ -127,6 +127,15 @@ export class EventEntry extends BaseEventEntry { return getRelatedEventId(this.event); } + // return a related event-id only if this entry is a reply + // excludes relations like redaction + get contextEventId() { + if (this.isReply) { + return this.relatedEventId; + } + return null; + } + get contextEntry() { return this._contextEntry; }