diff options
author | Erik Johnston <erik@matrix.org> | 2021-04-23 12:21:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 12:21:55 +0100 |
commit | 9d25a0ae65ce8728d0fda1eebaf0b469316f84d7 (patch) | |
tree | fca194d9ae52b9e60eeb4f9d72d1efa9b9b90682 /synapse/rest/client | |
parent | Check for space membership during a remote join of a restricted room (#9814) (diff) | |
download | synapse-9d25a0ae65ce8728d0fda1eebaf0b469316f84d7.tar.xz |
Split presence out of master (#9820)
Diffstat (limited to 'synapse/rest/client')
-rw-r--r-- | synapse/rest/client/v1/presence.py | 7 |
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, {} |