diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index ab24ef68..1d2c9a17 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -124,7 +124,7 @@ export class Timeline { pendingEvent: pe, member: this._ownMember, clock: this._clock, redactingEntry }); - this._applyAndEmitLocalRelationChange(pee, target => target.addLocalRelation(pee)); + this._applyAndEmitLocalRelationChange(pee, target => target.addRelation(pee)); return pee; } @@ -203,12 +203,12 @@ export class Timeline { if (pee.relatedEventId) { const relationTarget = entries.find(e => e.id === pee.relatedEventId); // no need to emit here as this entry is about to be added - relationTarget?.addLocalRelation(pee); + relationTarget?.addRelation(pee); } if (pee.redactingEntry) { const eventId = pee.redactingEntry.relatedEventId; const relationTarget = entries.find(e => e.id === eventId); - relationTarget?.addLocalRelation(pee); + relationTarget?.addRelation(pee); } } } @@ -272,7 +272,7 @@ export class Timeline { */ for (const entry of entries) { const relatedEntry = this._contextEntriesNotInTimeline.get(entry.relatedEventId); - if (relatedEntry?.addLocalRelation(entry)) { + if (relatedEntry?.addRelation(entry)) { // update other entries for which this entry is a context entry relatedEntry.contextForEntries?.forEach(e => { this._remoteEntries.findAndUpdate(te => te.id === e.id, () => { return { reply: relatedEntry }; }); diff --git a/src/matrix/room/timeline/entries/BaseEventEntry.js b/src/matrix/room/timeline/entries/BaseEventEntry.js index 2869bf68..4ee23b50 100644 --- a/src/matrix/room/timeline/entries/BaseEventEntry.js +++ b/src/matrix/room/timeline/entries/BaseEventEntry.js @@ -53,10 +53,13 @@ export class BaseEventEntry extends BaseEntry { } /** - aggregates local relation or local redaction of remote relation. + Aggregates relation or redaction of remote relation. + Used in two situations: + - to aggregate local relation/redaction of remote relation + - to mark this entry as being redacted in Timeline._updateEntriesFetchedFromHomeserver @return [string] returns the name of the field that has changed, if any */ - addLocalRelation(entry) { + addRelation(entry) { if (entry.eventType === REDACTION_TYPE && entry.isRelatedToId(this.id)) { if (!this._pendingRedactions) { this._pendingRedactions = []; diff --git a/src/matrix/room/timeline/entries/EventEntry.js b/src/matrix/room/timeline/entries/EventEntry.js index ea019917..13a10103 100644 --- a/src/matrix/room/timeline/entries/EventEntry.js +++ b/src/matrix/room/timeline/entries/EventEntry.js @@ -190,7 +190,7 @@ export function tests() { function addPendingReaction(target, key) { queueIndex += 1; - target.addLocalRelation(new PendingEventEntry({ + target.addRelation(new PendingEventEntry({ pendingEvent: new PendingEvent({data: { eventType: "m.reaction", content: createAnnotation(target.id, key), @@ -212,7 +212,7 @@ export function tests() { }); } queueIndex += 1; - target.addLocalRelation(new PendingEventEntry({ + target.addRelation(new PendingEventEntry({ pendingEvent: new PendingEvent({data: { eventType: "m.room.redaction", relatedTxnId: pendingReaction ? pendingReaction.id : null, diff --git a/src/matrix/room/timeline/entries/FragmentBoundaryEntry.js b/src/matrix/room/timeline/entries/FragmentBoundaryEntry.js index 7a8ed5d0..5d9ae4ca 100644 --- a/src/matrix/room/timeline/entries/FragmentBoundaryEntry.js +++ b/src/matrix/room/timeline/entries/FragmentBoundaryEntry.js @@ -134,6 +134,6 @@ export class FragmentBoundaryEntry extends BaseEntry { return new FragmentBoundaryEntry(neighbour, !this._isFragmentStart, this._fragmentIdComparer); } - addLocalRelation() {} + addRelation() {} removeLocalRelation() {} }