diff options
author | Erik Johnston <erik@matrix.org> | 2017-03-15 14:27:34 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-03-15 14:27:34 +0000 |
commit | 6c82de51002575e974907ab0a7d4fc6b0123bc8f (patch) | |
tree | 7338a0d9c64ae83255404a7527bbdf90705a1a44 /synapse/rest/client/v1/presence.py | |
parent | Merge pull request #1997 from matrix-org/dbkr/cas_partialdownload (diff) | |
download | synapse-6c82de51002575e974907ab0a7d4fc6b0123bc8f.tar.xz |
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.py | 3 |
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)) |