Don't highlight redacted events (#30519)

* Don't highlight redacted events

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-08-11 09:22:15 +01:00
committed by GitHub
parent 700068a558
commit 6ff71480d8
2 changed files with 14 additions and 2 deletions

View File

@@ -666,6 +666,8 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
if (this.context.timelineRenderingType === TimelineRenderingType.Notification) return false;
if (this.context.timelineRenderingType === TimelineRenderingType.ThreadsList) return false;
if (this.props.isRedacted) return false;
const cli = MatrixClientPeg.safeGet();
const actions = cli.getPushActionsForEvent(this.props.mxEvent.replacingEvent() || this.props.mxEvent);
// get the actions for the previous version of the event too if it is an edit

View File

@@ -503,14 +503,24 @@ describe("EventTile", () => {
expect(isHighlighted(container)).toBeFalsy();
});
it(`does not highlight when message's push actions does not have a highlight tweak`, () => {
it("does not highlight when message's push actions does not have a highlight tweak", () => {
mocked(client.getPushActionsForEvent).mockReturnValue({ notify: true, tweaks: {} });
const { container } = getComponent();
expect(isHighlighted(container)).toBeFalsy();
});
it(`highlights when message's push actions have a highlight tweak`, () => {
it("does not highlight when message's push actions have a highlight tweak but message has been redacted", () => {
mocked(client.getPushActionsForEvent).mockReturnValue({
notify: true,
tweaks: { [TweakName.Highlight]: true },
});
const { container } = getComponent({ isRedacted: true });
expect(isHighlighted(container)).toBeFalsy();
});
it("highlights when message's push actions have a highlight tweak", () => {
mocked(client.getPushActionsForEvent).mockReturnValue({
notify: true,
tweaks: { [TweakName.Highlight]: true },