From 4acb98c4963df51c08a59167b24f569a7c8b547e Mon Sep 17 00:00:00 2001 From: David Teller Date: Wed, 12 Jan 2022 13:27:03 +0100 Subject: [PATCH] [Fix] Nullcheck redactedEvent (#2103) We should only check whether a redacted event is a visibility event *if the redacted event is not null*. --- src/models/room.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/models/room.ts b/src/models/room.ts index 0f35211a2..d09c919cc 100644 --- a/src/models/room.ts +++ b/src/models/room.ts @@ -1441,6 +1441,15 @@ export class Room extends EventEmitter { // (in the sender and target fields). We should get those // RoomMember objects to update themselves when the events that // they are based on are changed. + + // Remove any visibility change on this event. + this.visibilityEvents.delete(redactId); + + // If this event is a visibility change event, remove it from the + // list of visibility changes and update any event affected by it. + if (redactedEvent.isVisibilityEvent()) { + this.redactVisibilityChangeEvent(event); + } } // FIXME: apply redactions to notification list @@ -1448,15 +1457,6 @@ export class Room extends EventEmitter { // NB: We continue to add the redaction event to the timeline so // clients can say "so and so redacted an event" if they wish to. Also // this may be needed to trigger an update. - - // Remove any visibility change on this event. - this.visibilityEvents.delete(redactId); - - // If this event is a visibility change event, remove it from the - // list of visibility changes and update any event affected by it. - if (redactedEvent.isVisibilityEvent()) { - this.redactVisibilityChangeEvent(event); - } } // Implement MSC3531: hiding messages.