Hide an event notification if it is redacted (#29605)

* Hide notifications from events that have been redacted.

* lint

* add a void

* Remove ?.
This commit is contained in:
Will Hunt 2025-03-28 08:46:43 +00:00 committed by GitHub
parent 829b588dbf
commit d7730f417b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
}