Add contextEventId

This commit is contained in:
RMidhunSuresh 2021-12-07 13:00:10 +05:30
parent 764e38f8c9
commit 06864a65b7
2 changed files with 11 additions and 2 deletions

View File

@ -245,9 +245,9 @@ export class Timeline {
} }
async _loadRelatedEvents(entries) { async _loadRelatedEvents(entries) {
const filteredEntries = entries.filter(e => !!e.relation); const filteredEntries = entries.filter(e => !!e.contextEventId);
for (const entry of filteredEntries) { for (const entry of filteredEntries) {
const id = entry.relatedEventId; const id = entry.contextEventId;
let contextEvent; let contextEvent;
// find in remote events // find in remote events
contextEvent = this.getByEventId(id); contextEvent = this.getByEventId(id);

View File

@ -127,6 +127,15 @@ export class EventEntry extends BaseEventEntry {
return getRelatedEventId(this.event); 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() { get contextEntry() {
return this._contextEntry; return this._contextEntry;
} }