Skip to content

Commit d7730f4

Browse files
authored
Hide an event notification if it is redacted (#29605)
* Hide notifications from events that have been redacted. * lint * add a void * Remove ?.
1 parent 829b588 commit d7730f4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/BasePlatform.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
type SSOAction,
1717
encodeUnpaddedBase64,
1818
type OidcRegistrationClientMetadata,
19+
MatrixEventEvent,
1920
} from "matrix-js-sdk/src/matrix";
2021
import { logger } from "matrix-js-sdk/src/logger";
2122

@@ -228,6 +229,16 @@ export default abstract class BasePlatform {
228229
window.focus();
229230
};
230231

232+
const closeHandler = (): void => notification.close();
233+
234+
// Clear a notification from a redacted event.
235+
if (ev) {
236+
ev.once(MatrixEventEvent.BeforeRedaction, closeHandler);
237+
notification.onclose = () => {
238+
ev.off(MatrixEventEvent.BeforeRedaction, closeHandler);
239+
};
240+
}
241+
231242
return notification;
232243
}
233244

0 commit comments

Comments
 (0)