Skip to content

Commit

Permalink
Revert event-mapper optimisations (#2171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Germain authored Feb 11, 2022
1 parent 25c1157 commit d9c3b88
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/event-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down

0 comments on commit d9c3b88

Please sign in to comment.