1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-07 23:02:56 +03:00

Out of sync thread summary in main timeline (#2153)

This commit is contained in:
Germain
2022-02-04 11:57:42 +00:00
committed by GitHub
parent b07457726b
commit 7faff66006
3 changed files with 23 additions and 7 deletions

View File

@@ -29,7 +29,21 @@ export function eventMapperFor(client: MatrixClient, options: MapperOpts): Event
const decrypt = options.decrypt !== false;
function mapper(plainOldJsObject: Partial<IEvent>) {
const event = new MatrixEvent(plainOldJsObject);
const room = client.getRoom(plainOldJsObject.room_id);
let event: MatrixEvent;
// If the event is already known to the room, let's re-use the model
// rather than creating a duplicate
if (room) {
event = room.findEventById(plainOldJsObject.event_id);
}
// If no event is found or if the event found was only local we can
// safely create a new model
if (!event || event.status) {
event = new MatrixEvent(plainOldJsObject);
}
if (event.isEncrypted()) {
if (!preventReEmit) {
client.reEmitter.reEmit(event, [