mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-09 11:55:37 +01:00
Rename method and add comment
This commit is contained in:
parent
ec8f6e8e0a
commit
091b55a265
@ -124,7 +124,7 @@ export class Timeline {
|
|||||||
pendingEvent: pe, member: this._ownMember,
|
pendingEvent: pe, member: this._ownMember,
|
||||||
clock: this._clock, redactingEntry
|
clock: this._clock, redactingEntry
|
||||||
});
|
});
|
||||||
this._applyAndEmitLocalRelationChange(pee, target => target.addLocalRelation(pee));
|
this._applyAndEmitLocalRelationChange(pee, target => target.addRelation(pee));
|
||||||
return pee;
|
return pee;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,12 +203,12 @@ export class Timeline {
|
|||||||
if (pee.relatedEventId) {
|
if (pee.relatedEventId) {
|
||||||
const relationTarget = entries.find(e => e.id === pee.relatedEventId);
|
const relationTarget = entries.find(e => e.id === pee.relatedEventId);
|
||||||
// no need to emit here as this entry is about to be added
|
// no need to emit here as this entry is about to be added
|
||||||
relationTarget?.addLocalRelation(pee);
|
relationTarget?.addRelation(pee);
|
||||||
}
|
}
|
||||||
if (pee.redactingEntry) {
|
if (pee.redactingEntry) {
|
||||||
const eventId = pee.redactingEntry.relatedEventId;
|
const eventId = pee.redactingEntry.relatedEventId;
|
||||||
const relationTarget = entries.find(e => e.id === eventId);
|
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) {
|
for (const entry of entries) {
|
||||||
const relatedEntry = this._contextEntriesNotInTimeline.get(entry.relatedEventId);
|
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
|
// update other entries for which this entry is a context entry
|
||||||
relatedEntry.contextForEntries?.forEach(e => {
|
relatedEntry.contextForEntries?.forEach(e => {
|
||||||
this._remoteEntries.findAndUpdate(te => te.id === e.id, () => { return { reply: relatedEntry }; });
|
this._remoteEntries.findAndUpdate(te => te.id === e.id, () => { return { reply: relatedEntry }; });
|
||||||
|
@ -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
|
@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 (entry.eventType === REDACTION_TYPE && entry.isRelatedToId(this.id)) {
|
||||||
if (!this._pendingRedactions) {
|
if (!this._pendingRedactions) {
|
||||||
this._pendingRedactions = [];
|
this._pendingRedactions = [];
|
||||||
|
@ -190,7 +190,7 @@ export function tests() {
|
|||||||
|
|
||||||
function addPendingReaction(target, key) {
|
function addPendingReaction(target, key) {
|
||||||
queueIndex += 1;
|
queueIndex += 1;
|
||||||
target.addLocalRelation(new PendingEventEntry({
|
target.addRelation(new PendingEventEntry({
|
||||||
pendingEvent: new PendingEvent({data: {
|
pendingEvent: new PendingEvent({data: {
|
||||||
eventType: "m.reaction",
|
eventType: "m.reaction",
|
||||||
content: createAnnotation(target.id, key),
|
content: createAnnotation(target.id, key),
|
||||||
@ -212,7 +212,7 @@ export function tests() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
queueIndex += 1;
|
queueIndex += 1;
|
||||||
target.addLocalRelation(new PendingEventEntry({
|
target.addRelation(new PendingEventEntry({
|
||||||
pendingEvent: new PendingEvent({data: {
|
pendingEvent: new PendingEvent({data: {
|
||||||
eventType: "m.room.redaction",
|
eventType: "m.room.redaction",
|
||||||
relatedTxnId: pendingReaction ? pendingReaction.id : null,
|
relatedTxnId: pendingReaction ? pendingReaction.id : null,
|
||||||
|
@ -134,6 +134,6 @@ export class FragmentBoundaryEntry extends BaseEntry {
|
|||||||
return new FragmentBoundaryEntry(neighbour, !this._isFragmentStart, this._fragmentIdComparer);
|
return new FragmentBoundaryEntry(neighbour, !this._isFragmentStart, this._fragmentIdComparer);
|
||||||
}
|
}
|
||||||
|
|
||||||
addLocalRelation() {}
|
addRelation() {}
|
||||||
removeLocalRelation() {}
|
removeLocalRelation() {}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user