1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Revert "Revert "Factor out the code for moving an event to the main timeline""

This reverts commit 272be48a54.
This commit is contained in:
Andy Balaam
2023-11-07 13:44:57 +00:00
parent 304c2b12bf
commit 582ea68c31

View File

@@ -1210,22 +1210,24 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
// If the redacted event was in a thread
if (room && this.threadRootId && this.threadRootId !== this.getId()) {
// Remove it from its thread
this.thread?.timelineSet.removeEvent(this.getId()!);
this.setThread(undefined);
// And insert it into the main timeline
const timeline = room.getLiveTimeline();
// We use insertEventIntoTimeline to insert it in timestamp order,
// because we don't know where it should go (until we have MSC4033).
timeline
.getTimelineSet()
.insertEventIntoTimeline(this, timeline, timeline.getState(EventTimeline.FORWARDS)!);
this.moveToMainTimeline(room);
}
this.invalidateExtensibleEvent();
}
private moveToMainTimeline(room: Room): void {
// Remove it from its thread
this.thread?.timelineSet.removeEvent(this.getId()!);
this.setThread(undefined);
// And insert it into the main timeline
const timeline = room.getLiveTimeline();
// We use insertEventIntoTimeline to insert it in timestamp order,
// because we don't know where it should go (until we have MSC4033).
timeline.getTimelineSet().insertEventIntoTimeline(this, timeline, timeline.getState(EventTimeline.FORWARDS)!);
}
/**
* Check if this event has been redacted
*