diff --git a/src/utils/beacon/timeline.ts b/src/utils/beacon/timeline.ts index d00872f865..9c566e0d68 100644 --- a/src/utils/beacon/timeline.ts +++ b/src/utils/beacon/timeline.ts @@ -23,5 +23,9 @@ import { M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon"; */ export const shouldDisplayAsBeaconTile = (event: MatrixEvent): boolean => ( M_BEACON_INFO.matches(event.getType()) && - !!event.getContent()?.live + ( + event.getContent()?.live || + // redacted beacons should show 'message deleted' tile + event.isRedacted() + ) ); diff --git a/test/utils/beacon/timeline-test.ts b/test/utils/beacon/timeline-test.ts index 59217d2459..610530c57a 100644 --- a/test/utils/beacon/timeline-test.ts +++ b/test/utils/beacon/timeline-test.ts @@ -25,11 +25,17 @@ describe('shouldDisplayAsBeaconTile', () => { const liveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: true }); const notLiveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: false }); const memberEvent = new MatrixEvent({ type: EventType.RoomMember }); + const redactedBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: false }); + redactedBeacon.makeRedacted(redactedBeacon); it('returns true for a beacon with live property set to true', () => { expect(shouldDisplayAsBeaconTile(liveBeacon)).toBe(true); }); + it('returns true for a redacted beacon', () => { + expect(shouldDisplayAsBeaconTile(redactedBeacon)).toBe(true); + }); + it('returns false for a beacon with live property set to false', () => { expect(shouldDisplayAsBeaconTile(notLiveBeacon)).toBe(false); });