fix(presence): make sendPresence toggle work for classic sync too
This commit is contained in:
1 parent
d1e002ac6d
commit
93728221bb
1 file changed
+5
-1
@@ -1,7 +1,7 @@
|
||||
import { useAtomValue, useSetAtom } from 'jotai';
|
||||
import { ReactNode, useCallback, useEffect, useRef } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { PushProcessor, RoomEvent, RoomEventHandlerMap } from '$types/matrix-sdk';
|
||||
import { PushProcessor, RoomEvent, RoomEventHandlerMap, SetPresence } from '$types/matrix-sdk';
|
||||
import parse from 'html-react-parser';
|
||||
import { getReactCustomHtmlParser, LINKIFY_OPTS } from '$plugins/react-custom-html-parser';
|
||||
import { sanitizeCustomHtml } from '$utils/sanitize';
|
||||
@@ -581,6 +581,10 @@ function PresenceFeature() {
|
||||
const [sendPresence] = useSetting(settingsAtom, 'sendPresence');
|
||||
|
||||
useEffect(() => {
|
||||
// Classic sync: set_presence query param on every /sync poll.
|
||||
// Passing undefined restores the default (online); Offline suppresses broadcasting.
|
||||
mx.setSyncPresence(sendPresence ? undefined : SetPresence.Offline);
|
||||
// Sliding sync: enable/disable the presence extension on the next poll.
|
||||
getSlidingSyncManager(mx)?.setPresenceEnabled(sendPresence);
|
||||
}, [mx, sendPresence]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user