Skip to content

Commit 6ff7148

Browse files
authored
Don't highlight redacted events (#30519)
* Don't highlight redacted events Signed-off-by: Michael Telatynski <[email protected]> * Add test Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent 700068a commit 6ff7148

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/components/views/rooms/EventTile.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,8 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
666666
if (this.context.timelineRenderingType === TimelineRenderingType.Notification) return false;
667667
if (this.context.timelineRenderingType === TimelineRenderingType.ThreadsList) return false;
668668

669+
if (this.props.isRedacted) return false;
670+
669671
const cli = MatrixClientPeg.safeGet();
670672
const actions = cli.getPushActionsForEvent(this.props.mxEvent.replacingEvent() || this.props.mxEvent);
671673
// get the actions for the previous version of the event too if it is an edit

test/unit-tests/components/views/rooms/EventTile-test.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,14 +503,24 @@ describe("EventTile", () => {
503503
expect(isHighlighted(container)).toBeFalsy();
504504
});
505505

506-
it(`does not highlight when message's push actions does not have a highlight tweak`, () => {
506+
it("does not highlight when message's push actions does not have a highlight tweak", () => {
507507
mocked(client.getPushActionsForEvent).mockReturnValue({ notify: true, tweaks: {} });
508508
const { container } = getComponent();
509509

510510
expect(isHighlighted(container)).toBeFalsy();
511511
});
512512

513-
it(`highlights when message's push actions have a highlight tweak`, () => {
513+
it("does not highlight when message's push actions have a highlight tweak but message has been redacted", () => {
514+
mocked(client.getPushActionsForEvent).mockReturnValue({
515+
notify: true,
516+
tweaks: { [TweakName.Highlight]: true },
517+
});
518+
const { container } = getComponent({ isRedacted: true });
519+
520+
expect(isHighlighted(container)).toBeFalsy();
521+
});
522+
523+
it("highlights when message's push actions have a highlight tweak", () => {
514524
mocked(client.getPushActionsForEvent).mockReturnValue({
515525
notify: true,
516526
tweaks: { [TweakName.Highlight]: true },

0 commit comments

Comments
 (0)