Use 'context' instead of 'related'

This commit is contained in:
RMidhunSuresh 2021-12-07 12:25:56 +05:30
parent 696980aca4
commit 764e38f8c9
2 changed files with 13 additions and 13 deletions

View file

@ -248,19 +248,19 @@ export class Timeline {
const filteredEntries = entries.filter(e => !!e.relation);
for (const entry of filteredEntries) {
const id = entry.relatedEventId;
let relatedEvent;
let contextEvent;
// find in remote events
relatedEvent = this.getByEventId(id);
contextEvent = this.getByEventId(id);
// find in storage
if (!relatedEvent) {
relatedEvent = await this._fetchEventFromStorage(id);
if (!contextEvent) {
contextEvent = await this._fetchEventFromStorage(id);
}
// fetch from hs
if (!relatedEvent) {
relatedEvent = await this._fetchEventFromHomeserver(id);
if (!contextEvent) {
contextEvent = await this._fetchEventFromHomeserver(id);
}
if (relatedEvent) {
entry.setRelatedEntry(relatedEvent);
if (contextEvent) {
entry.setContextEntry(contextEvent);
}
}
}

View file

@ -24,7 +24,7 @@ export class EventEntry extends BaseEventEntry {
this._eventEntry = eventEntry;
this._decryptionError = null;
this._decryptionResult = null;
this._relatedEntry = null;
this._contextEntry = null;
}
clone() {
@ -42,8 +42,8 @@ export class EventEntry extends BaseEventEntry {
}
}
setRelatedEntry(entry) {
this._relatedEntry = entry;
setContextEntry(entry) {
this._contextEntry = entry;
}
get event() {
@ -127,8 +127,8 @@ export class EventEntry extends BaseEventEntry {
return getRelatedEventId(this.event);
}
get relatedEntry() {
return this._relatedEntry;
get contextEntry() {
return this._contextEntry;
}
get isRedacted() {