1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-06 12:02:40 +03:00

Revert event-mapper optimisations (#2171)

This commit is contained in:
Germain
2022-02-11 12:55:44 +00:00
committed by GitHub
parent 25c115739c
commit d9c3b880fc

View File

@@ -29,21 +29,7 @@ export function eventMapperFor(client: MatrixClient, options: MapperOpts): Event
const decrypt = options.decrypt !== false;
function mapper(plainOldJsObject: Partial<IEvent>) {
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);
}
const event = new MatrixEvent(plainOldJsObject);
if (event.isEncrypted()) {
if (!preventReEmit) {
client.reEmitter.reEmit(event, [