Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chat.schildi.hide_ui: read_receipts #18

Draft
wants to merge 3 commits into
base: sc
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
readMarkerOutOfViewThresholdMs: number;
showHiddenEvents: boolean;
showReadReceipts: boolean;
schildichatHideUIReadReceipts: boolean;
showRedactions: boolean;
showJoinLeaves: boolean;
showAvatarChanges: boolean;
Expand Down Expand Up @@ -429,6 +430,7 @@
readMarkerOutOfViewThresholdMs: SettingsStore.getValue("readMarkerOutOfViewThresholdMs"),
showHiddenEvents: SettingsStore.getValue("showHiddenEventsInTimeline"),
showReadReceipts: true,
schildichatHideUIReadReceipts: false,
showRedactions: true,
showJoinLeaves: true,
showAvatarChanges: true,
Expand Down Expand Up @@ -662,6 +664,11 @@
activeCall: CallStore.instance.getActiveCall(roomId),
};

newState.schildichatHideUIReadReceipts =
room?.getLiveTimeline().getState(EventTimeline.FORWARDS)

Check failure on line 668 in src/components/structures/RoomView.tsx

View workflow job for this annotation

GitHub Actions / Typescript Strict Error Checker (--strict --noImplicitAny)

Object is possibly 'undefined'.

src/components/structures/RoomView.tsx:668:13 - Object is possibly 'undefined'.
.getStateEvents("chat.schildi.hide_ui", "read_receipts")?.getContent()?.hidden
|| false;

if (
this.state.mainSplitContentType !== MainSplitContentType.Timeline &&
newState.mainSplitContentType === MainSplitContentType.Timeline &&
Expand Down Expand Up @@ -1534,6 +1541,14 @@
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);
}
Expand Down Expand Up @@ -2396,7 +2411,7 @@
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}
Expand Down
1 change: 1 addition & 0 deletions src/contexts/RoomContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const RoomContext = createContext<IRoomState>({
readMarkerOutOfViewThresholdMs: 30000,
showHiddenEvents: false,
showReadReceipts: true,
schildichatHideUIReadReceipts: false,
showRedactions: true,
showJoinLeaves: true,
showAvatarChanges: true,
Expand Down
1 change: 1 addition & 0 deletions test/test-utils/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export function getRoomContext(room: Room, override: Partial<IRoomState>): IRoom
readMarkerOutOfViewThresholdMs: 30000,
showHiddenEvents: false,
showReadReceipts: true,
schildichatHideUIReadReceipts: false,
showRedactions: true,
showJoinLeaves: true,
showAvatarChanges: true,
Expand Down
Loading