summary refs log tree commit diff
path: root/synapse/rest/client/v1/presence.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-03-15 16:01:29 +0000
committerGitHub <noreply@github.com>2017-03-15 16:01:29 +0000
commit9d527191bcd14f51ae43cfccf18a34ecb19df801 (patch)
tree272a697640aaf3c919db0b63967908e89b8f16f5 /synapse/rest/client/v1/presence.py
parentMerge pull request #1997 from matrix-org/dbkr/cas_partialdownload (diff)
parentComment (diff)
downloadsynapse-9d527191bcd14f51ae43cfccf18a34ecb19df801.tar.xz
Merge pull request #2013 from matrix-org/erikj/presence_FASTER
Format presence events on the edges instead of reformatting them multiple times
Diffstat (limited to 'synapse/rest/client/v1/presence.py')
-rw-r--r--synapse/rest/client/v1/presence.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/rest/client/v1/presence.py b/synapse/rest/client/v1/presence.py
index eafdce865e..47b2dc45e7 100644
--- a/synapse/rest/client/v1/presence.py
+++ b/synapse/rest/client/v1/presence.py
@@ -19,6 +19,7 @@ from twisted.internet import defer
 
 from synapse.api.errors import SynapseError, AuthError
 from synapse.types import UserID
+from synapse.handlers.presence import format_user_presence_state
 from synapse.http.servlet import parse_json_object_from_request
 from .base import ClientV1RestServlet, client_path_patterns
 
@@ -33,6 +34,7 @@ class PresenceStatusRestServlet(ClientV1RestServlet):
     def __init__(self, hs):
         super(PresenceStatusRestServlet, self).__init__(hs)
         self.presence_handler = hs.get_presence_handler()
+        self.clock = hs.get_clock()
 
     @defer.inlineCallbacks
     def on_GET(self, request, user_id):
@@ -48,6 +50,7 @@ class PresenceStatusRestServlet(ClientV1RestServlet):
                 raise AuthError(403, "You are not allowed to see their presence.")
 
         state = yield self.presence_handler.get_state(target_user=user)
+        state = format_user_presence_state(state, self.clock.time_msec())
 
         defer.returnValue((200, state))