1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

Make local echo work for threads (#2026)

This commit is contained in:
Germain
2021-11-24 08:19:17 +00:00
committed by GitHub
parent 0ccde7807f
commit ddd6a05198
5 changed files with 383 additions and 90 deletions

View File

@@ -55,11 +55,20 @@ export class Thread extends TypedEventEmitter<ThreadEvent> {
this.timelineSet = new EventTimelineSet(this.room, {
unstableClientRelationAggregation: true,
timelineSupport: true,
pendingEvents: false,
pendingEvents: true,
});
events.forEach(event => this.addEvent(event));
room.on("Room.localEchoUpdated", this.onEcho);
room.on("Room.timeline", this.onEcho);
}
onEcho = (event: MatrixEvent) => {
if (this.timelineSet.eventIdToTimeline(event.getId())) {
this.emit(ThreadEvent.Update, this);
}
};
/**
* Add an event to the thread and updates
* the tail/root references if needed