You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-04 05:02:41 +03:00
Prepend events to thread when fetching the reply chain
This commit is contained in:
@@ -64,7 +64,7 @@ export class Thread extends EventEmitter {
|
||||
* Will fire "Thread.update"
|
||||
* @param event The event to add
|
||||
*/
|
||||
public async addEvent(event: MatrixEvent): Promise<void> {
|
||||
public async addEvent(event: MatrixEvent, toStartOfTimeline = false): Promise<void> {
|
||||
if (this.timelineSet.findEventById(event.getId()) || event.status !== null) {
|
||||
return;
|
||||
}
|
||||
@@ -85,7 +85,13 @@ export class Thread extends EventEmitter {
|
||||
const roomState = this.room.getLiveTimeline().getState(EventTimeline.FORWARDS);
|
||||
|
||||
event.setThread(this);
|
||||
this.timelineSet.addLiveEvent(event, DuplicateStrategy.Ignore, false, roomState);
|
||||
this.timelineSet.addEventToTimeline(
|
||||
event,
|
||||
this.timelineSet.getLiveTimeline(),
|
||||
toStartOfTimeline,
|
||||
false,
|
||||
roomState,
|
||||
);
|
||||
|
||||
if (this.ready) {
|
||||
this.client.decryptEventIfNeeded(event, {});
|
||||
@@ -108,7 +114,7 @@ export class Thread extends EventEmitter {
|
||||
);
|
||||
}
|
||||
|
||||
this.addEvent(mxEvent);
|
||||
this.addEvent(mxEvent, true);
|
||||
if (mxEvent.replyEventId) {
|
||||
await this.fetchReplyChain();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user