summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2022-04-13 16:21:07 +0100
committerGitHub <noreply@github.com>2022-04-13 16:21:07 +0100
commit73d8ded0b030a81e828c07bb134c08db67569e5d (patch)
tree1373d1a516232d02457d1f0abd1611337cde7fcd /synapse/rest
parentFix missing sync events during historical batch imports (#12319) (diff)
downloadsynapse-73d8ded0b030a81e828c07bb134c08db67569e5d.tar.xz
Prevent a sync request from removing a user's busy presence status (#12213)
In trying to use the MSC3026 busy presence status, the user's status
would be set back to 'online' next time they synced. This change makes
it so that syncing does not affect a user's presence status if it
is currently set to 'busy': it must be removed through the presence
API.

The MSC defers to implementations on the behaviour of busy presence,
so this ought to remain compatible with the MSC.
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/sync.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/synapse/rest/client/sync.py b/synapse/rest/client/sync.py
index 2e25e8638b..e8772f86e7 100644
--- a/synapse/rest/client/sync.py
+++ b/synapse/rest/client/sync.py
@@ -180,13 +180,10 @@ class SyncRestServlet(RestServlet):
 
         affect_presence = set_presence != PresenceState.OFFLINE
 
-        if affect_presence:
-            await self.presence_handler.set_state(
-                user, {"presence": set_presence}, True
-            )
-
         context = await self.presence_handler.user_syncing(
-            user.to_string(), affect_presence=affect_presence
+            user.to_string(),
+            affect_presence=affect_presence,
+            presence_state=set_presence,
         )
         with context:
             sync_result = await self.sync_handler.wait_for_sync_for_user(