diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index d79467735db..6806d053b1c 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -214,6 +214,7 @@ export interface IRoomState { readMarkerOutOfViewThresholdMs: number; showHiddenEvents: boolean; showReadReceipts: boolean; + schildichatHideUIReadReceipts: boolean; showRedactions: boolean; showJoinLeaves: boolean; showAvatarChanges: boolean; @@ -429,6 +430,7 @@ export class RoomView extends React.Component { readMarkerOutOfViewThresholdMs: SettingsStore.getValue("readMarkerOutOfViewThresholdMs"), showHiddenEvents: SettingsStore.getValue("showHiddenEventsInTimeline"), showReadReceipts: true, + schildichatHideUIReadReceipts: false, showRedactions: true, showJoinLeaves: true, showAvatarChanges: true, @@ -662,6 +664,11 @@ export class RoomView extends React.Component { activeCall: CallStore.instance.getActiveCall(roomId), }; + newState.schildichatHideUIReadReceipts = + room?.getLiveTimeline().getState(EventTimeline.FORWARDS) + .getStateEvents("chat.schildi.hide_ui", "read_receipts")?.getContent()?.hidden + || false; + if ( this.state.mainSplitContentType !== MainSplitContentType.Timeline && newState.mainSplitContentType === MainSplitContentType.Timeline && @@ -1534,6 +1541,14 @@ export class RoomView extends React.Component { this.setState({ tombstone: this.getRoomTombstone() }); break; + case "chat.schildi.hide_ui": + switch (ev.getStateKey()) { + case "read_receipts": + this.setState({ schildichatHideUIReadReceipts: ev.getContent()?.hidden }) + break; + } + break; + default: this.updatePermissions(this.state.room); } @@ -2396,7 +2411,7 @@ export class RoomView extends React.Component { timelineSet={this.state.room.getUnfilteredTimelineSet()} overlayTimelineSet={this.state.virtualRoom?.getUnfilteredTimelineSet()} overlayTimelineSetFilter={isCallEvent} - showReadReceipts={this.state.showReadReceipts} + showReadReceipts={(this.state.showReadReceipts && !this.state.schildichatHideUIReadReceipts) || this.state.showHiddenEvents} manageReadReceipts={!this.state.isPeeking} sendReadReceiptOnLoad={!this.state.wasContextSwitch} manageReadMarkers={!this.state.isPeeking} diff --git a/src/contexts/RoomContext.ts b/src/contexts/RoomContext.ts index 63d3049e803..059d788cebf 100644 --- a/src/contexts/RoomContext.ts +++ b/src/contexts/RoomContext.ts @@ -58,6 +58,7 @@ const RoomContext = createContext({ readMarkerOutOfViewThresholdMs: 30000, showHiddenEvents: false, showReadReceipts: true, + schildichatHideUIReadReceipts: false, showRedactions: true, showJoinLeaves: true, showAvatarChanges: true, diff --git a/test/test-utils/room.ts b/test/test-utils/room.ts index 46d18309ab4..28ec229965c 100644 --- a/test/test-utils/room.ts +++ b/test/test-utils/room.ts @@ -79,6 +79,7 @@ export function getRoomContext(room: Room, override: Partial): IRoom readMarkerOutOfViewThresholdMs: 30000, showHiddenEvents: false, showReadReceipts: true, + schildichatHideUIReadReceipts: false, showRedactions: true, showJoinLeaves: true, showAvatarChanges: true,