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:
committed by
GitHub
parent
700068a558
commit
6ff71480d8
@@ -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.Notification) return false;
|
||||||
if (this.context.timelineRenderingType === TimelineRenderingType.ThreadsList) return false;
|
if (this.context.timelineRenderingType === TimelineRenderingType.ThreadsList) return false;
|
||||||
|
|
||||||
|
if (this.props.isRedacted) return false;
|
||||||
|
|
||||||
const cli = MatrixClientPeg.safeGet();
|
const cli = MatrixClientPeg.safeGet();
|
||||||
const actions = cli.getPushActionsForEvent(this.props.mxEvent.replacingEvent() || this.props.mxEvent);
|
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
|
// get the actions for the previous version of the event too if it is an edit
|
||||||
|
|||||||
@@ -503,14 +503,24 @@ describe("EventTile", () => {
|
|||||||
expect(isHighlighted(container)).toBeFalsy();
|
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: {} });
|
mocked(client.getPushActionsForEvent).mockReturnValue({ notify: true, tweaks: {} });
|
||||||
const { container } = getComponent();
|
const { container } = getComponent();
|
||||||
|
|
||||||
expect(isHighlighted(container)).toBeFalsy();
|
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({
|
mocked(client.getPushActionsForEvent).mockReturnValue({
|
||||||
notify: true,
|
notify: true,
|
||||||
tweaks: { [TweakName.Highlight]: true },
|
tweaks: { [TweakName.Highlight]: true },
|
||||||
|
|||||||
Reference in New Issue
Block a user