diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index 2093881cc5..c7b7825fe6 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -16,6 +16,7 @@ import { type SSOAction, encodeUnpaddedBase64, type OidcRegistrationClientMetadata, + MatrixEventEvent, } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; @@ -228,6 +229,16 @@ export default abstract class BasePlatform { window.focus(); }; + const closeHandler = (): void => notification.close(); + + // Clear a notification from a redacted event. + if (ev) { + ev.once(MatrixEventEvent.BeforeRedaction, closeHandler); + notification.onclose = () => { + ev.off(MatrixEventEvent.BeforeRedaction, closeHandler); + }; + } + return notification; }