Skip to content

Commit 60172cf

Browse files
author
Evie Gauthier
committed
fix(presence): make sendPresence toggle work for classic sync too
1 parent a2b078b commit 60172cf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/app/pages/client/ClientNonUIFeatures.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useAtomValue, useSetAtom } from 'jotai';
22
import { ReactNode, useCallback, useEffect, useRef } from 'react';
33
import { useNavigate } from 'react-router-dom';
4-
import { PushProcessor, RoomEvent, RoomEventHandlerMap } from '$types/matrix-sdk';
4+
import { PushProcessor, RoomEvent, RoomEventHandlerMap, SetPresence } from '$types/matrix-sdk';
55
import parse from 'html-react-parser';
66
import { getReactCustomHtmlParser, LINKIFY_OPTS } from '$plugins/react-custom-html-parser';
77
import { sanitizeCustomHtml } from '$utils/sanitize';
@@ -566,6 +566,10 @@ function PresenceFeature() {
566566
const [sendPresence] = useSetting(settingsAtom, 'sendPresence');
567567

568568
useEffect(() => {
569+
// Classic sync: set_presence query param on every /sync poll.
570+
// Passing undefined restores the default (online); Offline suppresses broadcasting.
571+
mx.setSyncPresence(sendPresence ? undefined : SetPresence.Offline);
572+
// Sliding sync: enable/disable the presence extension on the next poll.
569573
getSlidingSyncManager(mx)?.setPresenceEnabled(sendPresence);
570574
}, [mx, sendPresence]);
571575

0 commit comments

Comments
 (0)