From d1c0ca78524041619d4f9f4d3fa51a8f20b21fda Mon Sep 17 00:00:00 2001 From: Joop Kiefte Date: Fri, 6 Mar 2026 20:01:10 +0000 Subject: [PATCH 1/5] fix: Element Call DM video calls + delayed event methods + post-lobby reload (port from Wally) - getCallIntentParams: voice rooms use join_existing/audio, DM rooms use start_call/video, group rooms use start_call/audio; intent param is now correctly passed to EC URL - SmallWidgetDriver: replace updateDelayedEvent with the three specific methods (cancelScheduledDelayedEvent, restartScheduledDelayedEvent, sendScheduledDelayedEvent) that ClientWidgetApi actually dispatches; fixes 'Connection lost' for all users - Post-lobby reload: after io.element.join, poll MatrixRTCSession.callMembershipsForRoom every 200ms; once EC's call member state event propagates, reload EC with intent=join_existing + skipLobby=true so it auto-joins the existing session and shows the full in-call grid instead of just the control bar; hangs up after 10s timeout - Fix registerActiveClientWidgetApi interface: clientWidget/iframeRef are nullable - Add resetActiveCallReady to CallProvider context --- src/app/features/call/SmallWidget.ts | 20 ++++++ src/app/features/call/SmallWidgetDriver.ts | 22 +++++-- src/app/pages/client/call/CallProvider.tsx | 11 +++- .../client/call/PersistentCallContainer.tsx | 61 +++++++++++++++++-- 4 files changed, 101 insertions(+), 13 deletions(-) diff --git a/src/app/features/call/SmallWidget.ts b/src/app/features/call/SmallWidget.ts index 24791198b..63186862e 100644 --- a/src/app/features/call/SmallWidget.ts +++ b/src/app/features/call/SmallWidget.ts @@ -15,6 +15,7 @@ import { MatrixClient, MatrixEvent, MatrixEventEvent, + Room, RoomStateEvent, } from '$types/matrix-sdk'; import { @@ -33,6 +34,25 @@ import { SmallWidgetDriver } from './SmallWidgetDriver'; const log = createLogger('SmallWidget'); +/** + * Returns the appropriate EC `intent` and `callIntent` URL params for a room. + * - Voice rooms (`isCallRoom()`): `join_existing` intent, `audio` callType (persistent channel). + * - DM rooms (≤2 joined members): `start_call` intent, `video` callType (1:1 video call). + * - Group rooms: `start_call` intent, `audio` callType. + */ +export function getCallIntentParams(room: Room | null | undefined): { + intent: 'join_existing' | 'start_call'; + callIntentParam: 'audio' | 'video'; +} { + const isVoiceRoom = room?.isCallRoom() ?? false; + // Require room to be non-null: unknown/missing room should not be treated as a DM. + const isDmRoom = room != null && !isVoiceRoom && room.currentState.getJoinedMemberCount() <= 2; + return { + intent: isVoiceRoom ? 'join_existing' : 'start_call', + callIntentParam: isDmRoom ? 'video' : 'audio', + }; +} + /** * Generates the URL for the Element Call widget. * @param mx - The MatrixClient instance. diff --git a/src/app/features/call/SmallWidgetDriver.ts b/src/app/features/call/SmallWidgetDriver.ts index 29f441cf3..467adbb54 100644 --- a/src/app/features/call/SmallWidgetDriver.ts +++ b/src/app/features/call/SmallWidgetDriver.ts @@ -295,16 +295,26 @@ export class SmallWidgetDriver extends WidgetDriver { /** * @experimental Part of MSC4140 & MSC4157 + * ClientWidgetApi dispatches three specific actions; the base WidgetDriver.updateDelayedEvent + * is never called. Implementing all three prevents 'Failed to override function' errors and + * the resulting 'Connection lost' in Element Call's MembershipManager. */ - public async updateDelayedEvent( - delayId: string, - action: UpdateDelayedEventAction - ): Promise { + public async cancelScheduledDelayedEvent(delayId: string): Promise { const client = this.mxClient; - if (!client) throw new Error('Not in a room or not attached to a client'); + await client._unstable_updateDelayedEvent(delayId, UpdateDelayedEventAction.Cancel); + } - await client._unstable_updateDelayedEvent(delayId, action); + public async restartScheduledDelayedEvent(delayId: string): Promise { + const client = this.mxClient; + if (!client) throw new Error('Not in a room or not attached to a client'); + await client._unstable_updateDelayedEvent(delayId, UpdateDelayedEventAction.Restart); + } + + public async sendScheduledDelayedEvent(delayId: string): Promise { + const client = this.mxClient; + if (!client) throw new Error('Not in a room or not attached to a client'); + await client._unstable_updateDelayedEvent(delayId, UpdateDelayedEventAction.Send); } /** diff --git a/src/app/pages/client/call/CallProvider.tsx b/src/app/pages/client/call/CallProvider.tsx index 69aa3bdbc..e484a0bf5 100644 --- a/src/app/pages/client/call/CallProvider.tsx +++ b/src/app/pages/client/call/CallProvider.tsx @@ -35,8 +35,8 @@ interface CallContextState { registerActiveClientWidgetApi: ( roomId: string | null, clientWidgetApi: ClientWidgetApi | null, - clientWidget: SmallWidget, - activeClientIframeRef: HTMLIFrameElement + clientWidget: SmallWidget | null, + activeClientIframeRef: HTMLIFrameElement | null ) => void; sendWidgetAction: ( action: WidgetApiToWidgetAction | string, @@ -46,6 +46,7 @@ interface CallContextState { isVideoEnabled: boolean; isChatOpen: boolean; isActiveCallReady: boolean; + resetActiveCallReady: () => void; toggleAudio: () => Promise; toggleVideo: () => Promise; toggleChat: () => Promise; @@ -280,6 +281,10 @@ export function CallProvider({ children }: CallProviderProps) { sendWidgetAction, ]); + const resetActiveCallReady = useCallback(() => { + setIsActiveCallReady(false); + }, []); + const toggleChat = useCallback(async () => { const newState = !isChatOpen; setIsChatOpenState(newState); @@ -300,6 +305,7 @@ export function CallProvider({ children }: CallProviderProps) { isAudioEnabled, isVideoEnabled, isActiveCallReady, + resetActiveCallReady, toggleAudio, toggleVideo, toggleChat, @@ -318,6 +324,7 @@ export function CallProvider({ children }: CallProviderProps) { isAudioEnabled, isVideoEnabled, isActiveCallReady, + resetActiveCallReady, toggleAudio, toggleVideo, toggleChat, diff --git a/src/app/pages/client/call/PersistentCallContainer.tsx b/src/app/pages/client/call/PersistentCallContainer.tsx index 318097863..a8b57a403 100644 --- a/src/app/pages/client/call/PersistentCallContainer.tsx +++ b/src/app/pages/client/call/PersistentCallContainer.tsx @@ -8,12 +8,14 @@ import { useRef, } from 'react'; import { ClientWidgetApi } from 'matrix-widget-api'; +import { MatrixRTCSession } from 'matrix-js-sdk/lib/matrixrtc/MatrixRTCSession'; import { Box } from 'folds'; import { createVirtualWidget, SmallWidget, getWidgetData, getWidgetUrl, + getCallIntentParams, } from '$features/call/SmallWidget'; import { useMatrixClient } from '$hooks/useMatrixClient'; import { useClientConfig } from '$hooks/useClientConfig'; @@ -33,6 +35,9 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro const callIframeRef = useRef(null); const callWidgetApiRef = useRef(null); const callSmallWidgetRef = useRef(null); + // After a non-voice room lobby join, reload EC with join_existing for proper in-call view. + const hasReloadedAfterLobbyRef = useRef(false); + const postLobbyIntentRef = useRef<'join_existing' | null>(null); const { activeCallRoomId, @@ -41,6 +46,8 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro isActiveCallReady, registerActiveClientWidgetApi, activeClientWidget, + resetActiveCallReady, + hangUp, } = useCallState(); const mx = useMatrixClient(); const clientConfig = useClientConfig(); @@ -56,11 +63,15 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro smallWidgetRef: MutableRefObject, iframeRef: MutableRefObject, skipLobby: boolean, - themeKind: ThemeKind | null + themeKind: ThemeKind | null, + intentOverride?: 'join_existing' ) => { if (mx?.getUserId()) { if (activeCallRoomId && !isActiveCallReady) { const roomIdToSet = activeCallRoomId; + const room = mx.getRoom(roomIdToSet); + const { intent: intentParam, callIntentParam } = getCallIntentParams(room); + const effectiveIntent = intentOverride ?? intentParam; const widgetId = `element-call-${roomIdToSet}-${Date.now()}`; const newUrl = getWidgetUrl( @@ -69,11 +80,12 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro clientConfig.elementCallUrl ?? '', widgetId, { - skipLobby: skipLobby.toString(), + skipLobby: (intentOverride === 'join_existing' ? true : skipLobby).toString(), returnToLobby: 'true', perParticipantE2EE: 'true', theme: themeKind, - callIntent: 'audio', + intent: effectiveIntent, + callIntent: callIntentParam, } ); @@ -106,7 +118,7 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro 'm.call', newUrl, false, - getWidgetData(mx, roomIdToSet, {}, { skipLobby: true, callIntent: 'audio' }), + getWidgetData(mx, roomIdToSet, {}, { skipLobby: true, intent: effectiveIntent, callIntent: callIntentParam }), roomIdToSet ); @@ -134,9 +146,48 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro ] ); + // After a non-voice room lobby join, poll until EC's call member state event has propagated + // to the room, then reload EC with intent=join_existing + skipLobby=true so it auto-joins + // the existing session and shows the full in-call grid. Hangs up if the session never + // appears (e.g. EC failed to send its state event) to avoid leaving the user stuck. + useEffect(() => { + if (!activeCallRoomId) { + hasReloadedAfterLobbyRef.current = false; + return undefined; + } + if (isActiveCallReady && !hasReloadedAfterLobbyRef.current) { + const room = mx?.getRoom(activeCallRoomId); + // Voice rooms already use join_existing and work correctly; skip reload for them. + if (room && !room.isCallRoom()) { + hasReloadedAfterLobbyRef.current = true; + const POLL_INTERVAL_MS = 200; + const TIMEOUT_MS = 10000; + const startTime = Date.now(); + const pollTimer = setInterval(() => { + if (MatrixRTCSession.callMembershipsForRoom(room).length > 0) { + clearInterval(pollTimer); + callSmallWidgetRef.current?.stopMessaging(); + callWidgetApiRef.current = null; + callSmallWidgetRef.current = null; + registerActiveClientWidgetApi(activeCallRoomId, null, null, null); + postLobbyIntentRef.current = 'join_existing'; + resetActiveCallReady(); + } else if (Date.now() - startTime >= TIMEOUT_MS) { + clearInterval(pollTimer); + hangUp(); + } + }, POLL_INTERVAL_MS); + return () => clearInterval(pollTimer); + } + } + return undefined; + }, [isActiveCallReady, activeCallRoomId, mx, registerActiveClientWidgetApi, resetActiveCallReady, hangUp]); + useEffect(() => { if (activeCallRoomId) { - setupWidget(callWidgetApiRef, callSmallWidgetRef, callIframeRef, true, theme.kind); + const intentOverride = postLobbyIntentRef.current ?? undefined; + postLobbyIntentRef.current = null; + setupWidget(callWidgetApiRef, callSmallWidgetRef, callIframeRef, true, theme.kind, intentOverride); } }, [ theme, From d416bb228b15dc78607b2452148365b0f3cb24f7 Mon Sep 17 00:00:00 2001 From: Joop Kiefte Date: Fri, 6 Mar 2026 22:23:54 +0000 Subject: [PATCH 2/5] chore: add changeset for element-call-dm PR --- .changeset/element-call-dm-video-calls.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/element-call-dm-video-calls.md diff --git a/.changeset/element-call-dm-video-calls.md b/.changeset/element-call-dm-video-calls.md new file mode 100644 index 000000000..99841dc1b --- /dev/null +++ b/.changeset/element-call-dm-video-calls.md @@ -0,0 +1,5 @@ +--- +sable: patch +--- + +Fix Element Call video/audio calls in DM and non-voice rooms: after joining through the lobby, the in-call grid now displays correctly instead of showing only the control bar. From 86857e5f9db5ac4b0123899229968c836e34e53b Mon Sep 17 00:00:00 2001 From: Joop Kiefte Date: Sat, 7 Mar 2026 00:14:09 +0000 Subject: [PATCH 3/5] fix: apply post-lobby reload to voice rooms too (same timing issue as DM calls) --- .../pages/client/call/PersistentCallContainer.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/pages/client/call/PersistentCallContainer.tsx b/src/app/pages/client/call/PersistentCallContainer.tsx index a8b57a403..d1cf8c243 100644 --- a/src/app/pages/client/call/PersistentCallContainer.tsx +++ b/src/app/pages/client/call/PersistentCallContainer.tsx @@ -35,7 +35,7 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro const callIframeRef = useRef(null); const callWidgetApiRef = useRef(null); const callSmallWidgetRef = useRef(null); - // After a non-voice room lobby join, reload EC with join_existing for proper in-call view. + // After any lobby join, reload EC with join_existing for proper in-call view. const hasReloadedAfterLobbyRef = useRef(false); const postLobbyIntentRef = useRef<'join_existing' | null>(null); @@ -146,10 +146,11 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro ] ); - // After a non-voice room lobby join, poll until EC's call member state event has propagated - // to the room, then reload EC with intent=join_existing + skipLobby=true so it auto-joins - // the existing session and shows the full in-call grid. Hangs up if the session never - // appears (e.g. EC failed to send its state event) to avoid leaving the user stuck. + // After any lobby join, poll until EC's call member state event has propagated to the room, + // then reload EC with intent=join_existing + skipLobby=true so it auto-joins the existing + // session and shows the full in-call grid. Hangs up if the session never appears. + // Applies to all room types: DM/group (start_call) and voice rooms (join_existing) both + // hit the same timing issue where the in-call grid is not shown after the first join. useEffect(() => { if (!activeCallRoomId) { hasReloadedAfterLobbyRef.current = false; @@ -157,8 +158,7 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro } if (isActiveCallReady && !hasReloadedAfterLobbyRef.current) { const room = mx?.getRoom(activeCallRoomId); - // Voice rooms already use join_existing and work correctly; skip reload for them. - if (room && !room.isCallRoom()) { + if (room) { hasReloadedAfterLobbyRef.current = true; const POLL_INTERVAL_MS = 200; const TIMEOUT_MS = 10000; From a3470e02e271edb9d602ad3b0f9ad3b7cd0bec7c Mon Sep 17 00:00:00 2001 From: 7w1 Date: Fri, 6 Mar 2026 20:31:51 -0600 Subject: [PATCH 4/5] split read and typing indicators --- ...able_picture_in_picture_in_element_call.md | 2 +- .changeset/split_typing_and_read.md | 5 +++ src/app/features/room-nav/RoomNavItem.tsx | 4 +-- src/app/features/room/Room.tsx | 6 ++-- src/app/features/room/RoomTimeline.tsx | 32 +++++++++---------- src/app/features/room/RoomView.tsx | 4 +-- src/app/features/room/RoomViewHeader.tsx | 4 +-- src/app/features/settings/general/General.tsx | 12 +++++-- src/app/pages/client/direct/Direct.tsx | 4 +-- src/app/pages/client/home/Home.tsx | 4 +-- src/app/pages/client/inbox/Notifications.tsx | 10 +++--- src/app/pages/client/sidebar/DirectTab.tsx | 4 +-- src/app/pages/client/sidebar/HomeTab.tsx | 4 +-- src/app/pages/client/sidebar/SpaceTabs.tsx | 4 +-- src/app/pages/client/space/Space.tsx | 4 +-- src/app/state/settings.ts | 2 ++ 16 files changed, 60 insertions(+), 45 deletions(-) create mode 100644 .changeset/split_typing_and_read.md diff --git a/.changeset/add_setting_to_enable_picture_in_picture_in_element_call.md b/.changeset/add_setting_to_enable_picture_in_picture_in_element_call.md index 521791c62..fd212c46d 100644 --- a/.changeset/add_setting_to_enable_picture_in_picture_in_element_call.md +++ b/.changeset/add_setting_to_enable_picture_in_picture_in_element_call.md @@ -2,4 +2,4 @@ sable: minor --- -# Add setting to enable picture-in-picture in element-call +Add setting to enable picture-in-picture in element-call diff --git a/.changeset/split_typing_and_read.md b/.changeset/split_typing_and_read.md new file mode 100644 index 000000000..bd1aed0c8 --- /dev/null +++ b/.changeset/split_typing_and_read.md @@ -0,0 +1,5 @@ +--- +sable: patch +--- + +Split typing and read status settings, allowing toggling off one and not the other. diff --git a/src/app/features/room-nav/RoomNavItem.tsx b/src/app/features/room-nav/RoomNavItem.tsx index 81cb1072f..9ba8b0f83 100644 --- a/src/app/features/room-nav/RoomNavItem.tsx +++ b/src/app/features/room-nav/RoomNavItem.tsx @@ -93,7 +93,7 @@ type RoomNavItemMenuProps = { const RoomNavItemMenu = forwardRef( ({ room, requestClose, notificationMode }, ref) => { const mx = useMatrixClient(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const unread = useRoomUnread(room.roomId, roomToUnreadAtom); const powerLevels = usePowerLevels(room); const creators = useRoomCreators(room); @@ -106,7 +106,7 @@ const RoomNavItemMenu = forwardRef( const [invitePrompt, setInvitePrompt] = useState(false); const handleMarkAsRead = () => { - markAsRead(mx, room.roomId, hideActivity); + markAsRead(mx, room.roomId, hideReads); requestClose(); }; diff --git a/src/app/features/room/Room.tsx b/src/app/features/room/Room.tsx index c6983eb47..f2619e6ad 100644 --- a/src/app/features/room/Room.tsx +++ b/src/app/features/room/Room.tsx @@ -25,7 +25,7 @@ export function Room() { const [isDrawer] = useSetting(settingsAtom, 'isPeopleDrawer'); const [isWidgetDrawerOpen] = useSetting(settingsAtom, 'isWidgetDrawer'); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const screenSize = useScreenSizeContext(); const powerLevels = usePowerLevels(room); const members = useRoomMembers(mx, room.roomId); @@ -36,10 +36,10 @@ export function Room() { useCallback( (evt) => { if (isKeyHotkey('escape', evt)) { - markAsRead(mx, room.roomId, hideActivity); + markAsRead(mx, room.roomId, hideReads); } }, - [mx, room.roomId, hideActivity] + [mx, room.roomId, hideReads] ) ); diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index 5e448993e..37021e37c 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -560,7 +560,7 @@ export function RoomTimeline({ }: RoomTimelineProps) { const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const [messageLayout] = useSetting(settingsAtom, 'messageLayout'); const [messageSpacing] = useSetting(settingsAtom, 'messageSpacing'); const [hideMembershipEvents] = useSetting(settingsAtom, 'hideMembershipEvents'); @@ -754,7 +754,7 @@ export function RoomTimeline({ // Check if the document is in focus (user is actively viewing the app), // and either there are no unread messages or the latest message is from the current user. // If either condition is met, trigger the markAsRead function to send a read receipt. - requestAnimationFrame(() => markAsRead(mx, mEvt.getRoomId()!, hideActivity)); + requestAnimationFrame(() => markAsRead(mx, mEvt.getRoomId()!, hideReads)); } if (!document.hasFocus() && !unreadInfo) { @@ -780,7 +780,7 @@ export function RoomTimeline({ setUnreadInfo(getRoomUnreadInfo(room)); } }, - [mx, room, unreadInfo, hideActivity] + [mx, room, unreadInfo, hideReads] ) ); @@ -884,15 +884,15 @@ export function RoomTimeline({ const tryAutoMarkAsRead = useCallback(() => { const readUptoEventId = readUptoEventIdRef.current; if (!readUptoEventId) { - requestAnimationFrame(() => markAsRead(mx, room.roomId, hideActivity)); + requestAnimationFrame(() => markAsRead(mx, room.roomId, hideReads)); return; } const evtTimeline = getEventTimeline(room, readUptoEventId); const latestTimeline = evtTimeline && getFirstLinkedTimeline(evtTimeline, Direction.Forward); if (latestTimeline === room.getLiveTimeline()) { - requestAnimationFrame(() => markAsRead(mx, room.roomId, hideActivity)); + requestAnimationFrame(() => markAsRead(mx, room.roomId, hideReads)); } - }, [mx, room, hideActivity]); + }, [mx, room, hideReads]); const debounceSetAtBottom = useDebounce( useCallback((entry: IntersectionObserverEntry) => { @@ -1119,7 +1119,7 @@ export function RoomTimeline({ }; const handleMarkAsRead = () => { - markAsRead(mx, room.roomId, hideActivity); + markAsRead(mx, room.roomId, hideReads); }; const handleOpenReply: MouseEventHandler = useCallback( @@ -1363,7 +1363,7 @@ export function RoomTimeline({ /> ) } - hideReadReceipts={hideActivity} + hideReadReceipts={hideReads} showDeveloperTools={showDeveloperTools} memberPowerTag={getMemberPowerTag(senderId)} hour24Clock={hour24Clock} @@ -1450,7 +1450,7 @@ export function RoomTimeline({ /> ) } - hideReadReceipts={hideActivity} + hideReadReceipts={hideReads} showDeveloperTools={showDeveloperTools} memberPowerTag={getMemberPowerTag(mEvent.getSender() ?? '')} hour24Clock={hour24Clock} @@ -1572,7 +1572,7 @@ export function RoomTimeline({ /> ) } - hideReadReceipts={hideActivity} + hideReadReceipts={hideReads} showDeveloperTools={showDeveloperTools} memberPowerTag={getMemberPowerTag(mEvent.getSender() ?? '')} hour24Clock={hour24Clock} @@ -1624,7 +1624,7 @@ export function RoomTimeline({ highlight={highlighted} messageSpacing={messageSpacing} canDelete={canRedact || mEvent.getSender() === mx.getUserId()} - hideReadReceipts={hideActivity} + hideReadReceipts={hideReads} showDeveloperTools={showDeveloperTools} > (null); const roomViewRef = useRef(null); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const screenSize = useScreenSizeContext(); const { roomId } = room; @@ -184,7 +184,7 @@ export function RoomView({ room, eventId }: { room: Room; eventId?: string }) { )} - {hideActivity ? : } + {hideReads ? : } diff --git a/src/app/features/room/RoomViewHeader.tsx b/src/app/features/room/RoomViewHeader.tsx index b0ccb91cb..0490350fc 100644 --- a/src/app/features/room/RoomViewHeader.tsx +++ b/src/app/features/room/RoomViewHeader.tsx @@ -106,7 +106,7 @@ type RoomMenuProps = { }; const RoomMenu = forwardRef(({ room, requestClose }, ref) => { const mx = useMatrixClient(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const unread = useRoomUnread(room.roomId, roomToUnreadAtom); const powerLevels = usePowerLevelsContext(); const creators = useRoomCreators(room); @@ -123,7 +123,7 @@ const RoomMenu = forwardRef(({ room, requestClose const [directInvitePrompt, setDirectInvitePrompt] = useState(false); const handleMarkAsRead = () => { - markAsRead(mx, room.roomId, hideActivity); + markAsRead(mx, room.roomId, hideReads); requestClose(); }; diff --git a/src/app/features/settings/general/General.tsx b/src/app/features/settings/general/General.tsx index 16b98461c..384ecf086 100644 --- a/src/app/features/settings/general/General.tsx +++ b/src/app/features/settings/general/General.tsx @@ -404,6 +404,7 @@ function Editor({ isMobile }: { isMobile: boolean }) { const [enterForNewline, setEnterForNewline] = useSetting(settingsAtom, 'enterForNewline'); const [isMarkdown, setIsMarkdown] = useSetting(settingsAtom, 'isMarkdown'); const [hideActivity, setHideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads, setHideReads] = useSetting(settingsAtom, 'hideReads'); return ( @@ -435,11 +436,18 @@ function Editor({ isMobile }: { isMobile: boolean }) { } /> + + } + /> + ); } diff --git a/src/app/pages/client/direct/Direct.tsx b/src/app/pages/client/direct/Direct.tsx index 7f19df3f6..657cc199a 100644 --- a/src/app/pages/client/direct/Direct.tsx +++ b/src/app/pages/client/direct/Direct.tsx @@ -58,13 +58,13 @@ type DirectMenuProps = { }; const DirectMenu = forwardRef(({ requestClose }, ref) => { const mx = useMatrixClient(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const orphanRooms = useDirectRooms(); const unread = useRoomsUnread(orphanRooms, roomToUnreadAtom); const handleMarkAsRead = () => { if (!unread) return; - orphanRooms.forEach((rId) => markAsRead(mx, rId, hideActivity)); + orphanRooms.forEach((rId) => markAsRead(mx, rId, hideReads)); requestClose(); }; diff --git a/src/app/pages/client/home/Home.tsx b/src/app/pages/client/home/Home.tsx index 4b3e61c98..d798077ad 100644 --- a/src/app/pages/client/home/Home.tsx +++ b/src/app/pages/client/home/Home.tsx @@ -69,13 +69,13 @@ type HomeMenuProps = { }; const HomeMenu = forwardRef(({ requestClose }, ref) => { const orphanRooms = useHomeRooms(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const unread = useRoomsUnread(orphanRooms, roomToUnreadAtom); const mx = useMatrixClient(); const handleMarkAsRead = () => { if (!unread) return; - orphanRooms.forEach((rId) => markAsRead(mx, rId, hideActivity)); + orphanRooms.forEach((rId) => markAsRead(mx, rId, hideReads)); requestClose(); }; diff --git a/src/app/pages/client/inbox/Notifications.tsx b/src/app/pages/client/inbox/Notifications.tsx index 2d82521da..79234851b 100644 --- a/src/app/pages/client/inbox/Notifications.tsx +++ b/src/app/pages/client/inbox/Notifications.tsx @@ -207,7 +207,7 @@ type RoomNotificationsGroupProps = { notifications: INotification[]; mediaAutoLoad?: boolean; urlPreview?: boolean; - hideActivity: boolean; + hideReads: boolean; onOpen: (roomId: string, eventId: string) => void; legacyUsernameColor?: boolean; hour24Clock: boolean; @@ -218,7 +218,7 @@ function RoomNotificationsGroupComp({ notifications, mediaAutoLoad, urlPreview, - hideActivity, + hideReads, onOpen, legacyUsernameColor, hour24Clock, @@ -414,7 +414,7 @@ function RoomNotificationsGroupComp({ onOpen(room.roomId, eventId); }; const handleMarkAsRead = () => { - markAsRead(mx, room.roomId, hideActivity); + markAsRead(mx, room.roomId, hideReads); }; return ( @@ -565,7 +565,7 @@ const FAST_REFRESH_MS = 2500; export function Notifications() { const mx = useMatrixClient(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const [mediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad'); const [urlPreview] = useSetting(settingsAtom, 'urlPreview'); const [legacyUsernameColor] = useSetting(settingsAtom, 'legacyUsernameColor'); @@ -720,7 +720,7 @@ export function Notifications() { notifications={group.notifications} mediaAutoLoad={mediaAutoLoad} urlPreview={urlPreview} - hideActivity={hideActivity} + hideReads={hideReads} onOpen={navigateRoom} legacyUsernameColor={ legacyUsernameColor || mDirects.has(groupRoom.roomId) diff --git a/src/app/pages/client/sidebar/DirectTab.tsx b/src/app/pages/client/sidebar/DirectTab.tsx index b4a90be50..b59f852c6 100644 --- a/src/app/pages/client/sidebar/DirectTab.tsx +++ b/src/app/pages/client/sidebar/DirectTab.tsx @@ -31,13 +31,13 @@ type DirectMenuProps = { }; const DirectMenu = forwardRef(({ requestClose }, ref) => { const orphanRooms = useDirectRooms(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const unread = useRoomsUnread(orphanRooms, roomToUnreadAtom); const mx = useMatrixClient(); const handleMarkAsRead = () => { if (!unread) return; - orphanRooms.forEach((rId) => markAsRead(mx, rId, hideActivity)); + orphanRooms.forEach((rId) => markAsRead(mx, rId, hideReads)); requestClose(); }; diff --git a/src/app/pages/client/sidebar/HomeTab.tsx b/src/app/pages/client/sidebar/HomeTab.tsx index a19aee989..ba02326ee 100644 --- a/src/app/pages/client/sidebar/HomeTab.tsx +++ b/src/app/pages/client/sidebar/HomeTab.tsx @@ -32,13 +32,13 @@ type HomeMenuProps = { }; const HomeMenu = forwardRef(({ requestClose }, ref) => { const orphanRooms = useHomeRooms(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const unread = useRoomsUnread(orphanRooms, roomToUnreadAtom); const mx = useMatrixClient(); const handleMarkAsRead = () => { if (!unread) return; - orphanRooms.forEach((rId) => markAsRead(mx, rId, hideActivity)); + orphanRooms.forEach((rId) => markAsRead(mx, rId, hideReads)); requestClose(); }; diff --git a/src/app/pages/client/sidebar/SpaceTabs.tsx b/src/app/pages/client/sidebar/SpaceTabs.tsx index bc3927da5..15ebd518d 100644 --- a/src/app/pages/client/sidebar/SpaceTabs.tsx +++ b/src/app/pages/client/sidebar/SpaceTabs.tsx @@ -102,7 +102,7 @@ type SpaceMenuProps = { const SpaceMenu = forwardRef( ({ room, requestClose, onUnpin }, ref) => { const mx = useMatrixClient(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const roomToParents = useAtomValue(roomToParentsAtom); const powerLevels = usePowerLevels(room); const creators = useRoomCreators(room); @@ -121,7 +121,7 @@ const SpaceMenu = forwardRef( const unread = useRoomsUnread(allChild, roomToUnreadAtom); const handleMarkAsRead = () => { - allChild.forEach((childRoomId) => markAsRead(mx, childRoomId, hideActivity)); + allChild.forEach((childRoomId) => markAsRead(mx, childRoomId, hideReads)); requestClose(); }; diff --git a/src/app/pages/client/space/Space.tsx b/src/app/pages/client/space/Space.tsx index d83769dd1..7cfe5417e 100644 --- a/src/app/pages/client/space/Space.tsx +++ b/src/app/pages/client/space/Space.tsx @@ -80,7 +80,7 @@ type SpaceMenuProps = { }; const SpaceMenu = forwardRef(({ room, requestClose }, ref) => { const mx = useMatrixClient(); - const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); + const [hideReads] = useSetting(settingsAtom, 'hideReads'); const [developerTools] = useSetting(settingsAtom, 'developerTools'); const roomToParents = useAtomValue(roomToParentsAtom); const powerLevels = usePowerLevels(room); @@ -101,7 +101,7 @@ const SpaceMenu = forwardRef(({ room, requestClo const unread = useRoomsUnread(allChild, roomToUnreadAtom); const handleMarkAsRead = () => { - allChild.forEach((childRoomId) => markAsRead(mx, childRoomId, hideActivity)); + allChild.forEach((childRoomId) => markAsRead(mx, childRoomId, hideReads)); requestClose(); }; diff --git a/src/app/state/settings.ts b/src/app/state/settings.ts index 318485b05..68aa8ff0d 100644 --- a/src/app/state/settings.ts +++ b/src/app/state/settings.ts @@ -78,6 +78,7 @@ export interface Settings { showUnreadCounts: boolean; badgeCountDMsOnly: boolean; showPingCounts: boolean; + hideReads: boolean; } const defaultSettings: Settings = { @@ -142,6 +143,7 @@ const defaultSettings: Settings = { showUnreadCounts: true, badgeCountDMsOnly: false, showPingCounts: true, + hideReads: false, }; export const getSettings = () => { From 335380f8c3b045a6f5143d741ffd21db7112da87 Mon Sep 17 00:00:00 2001 From: 7w1 Date: Fri, 6 Mar 2026 20:50:38 -0600 Subject: [PATCH 5/5] fix formatting and lint --- .../client/call/PersistentCallContainer.tsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/app/pages/client/call/PersistentCallContainer.tsx b/src/app/pages/client/call/PersistentCallContainer.tsx index d1cf8c243..f6548bc76 100644 --- a/src/app/pages/client/call/PersistentCallContainer.tsx +++ b/src/app/pages/client/call/PersistentCallContainer.tsx @@ -118,7 +118,12 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro 'm.call', newUrl, false, - getWidgetData(mx, roomIdToSet, {}, { skipLobby: true, intent: effectiveIntent, callIntent: callIntentParam }), + getWidgetData( + mx, + roomIdToSet, + {}, + { skipLobby: true, intent: effectiveIntent, callIntent: callIntentParam } + ), roomIdToSet ); @@ -181,13 +186,27 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro } } return undefined; - }, [isActiveCallReady, activeCallRoomId, mx, registerActiveClientWidgetApi, resetActiveCallReady, hangUp]); + }, [ + isActiveCallReady, + activeCallRoomId, + mx, + registerActiveClientWidgetApi, + resetActiveCallReady, + hangUp, + ]); useEffect(() => { if (activeCallRoomId) { const intentOverride = postLobbyIntentRef.current ?? undefined; postLobbyIntentRef.current = null; - setupWidget(callWidgetApiRef, callSmallWidgetRef, callIframeRef, true, theme.kind, intentOverride); + setupWidget( + callWidgetApiRef, + callSmallWidgetRef, + callIframeRef, + true, + theme.kind, + intentOverride + ); } }, [ theme,