summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-04-23 12:21:55 +0100
committerGitHub <noreply@github.com>2021-04-23 12:21:55 +0100
commit9d25a0ae65ce8728d0fda1eebaf0b469316f84d7 (patch)
treefca194d9ae52b9e60eeb4f9d72d1efa9b9b90682 /synapse/rest/client
parentCheck for space membership during a remote join of a restricted room (#9814) (diff)
downloadsynapse-9d25a0ae65ce8728d0fda1eebaf0b469316f84d7.tar.xz
Split presence out of master (#9820)
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/v1/presence.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/presence.py b/synapse/rest/client/v1/presence.py
index c232484f29..2b24fe5aa6 100644
--- a/synapse/rest/client/v1/presence.py
+++ b/synapse/rest/client/v1/presence.py
@@ -35,10 +35,15 @@ class PresenceStatusRestServlet(RestServlet):
         self.clock = hs.get_clock()
         self.auth = hs.get_auth()
 
+        self._use_presence = hs.config.server.use_presence
+
     async def on_GET(self, request, user_id):
         requester = await self.auth.get_user_by_req(request)
         user = UserID.from_string(user_id)
 
+        if not self._use_presence:
+            return 200, {"presence": "offline"}
+
         if requester.user != user:
             allowed = await self.presence_handler.is_visible(
                 observed_user=user, observer_user=requester.user
@@ -80,7 +85,7 @@ class PresenceStatusRestServlet(RestServlet):
         except Exception:
             raise SynapseError(400, "Unable to parse state")
 
-        if self.hs.config.use_presence:
+        if self._use_presence:
             await self.presence_handler.set_state(user, state)
 
         return 200, {}