diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-01-26 16:32:40 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-01-26 16:32:40 +0000 |
commit | 3186c5bdbc49cf7cbca3ae0b45bc8657b069a9a8 (patch) | |
tree | dd7ba7aeb2be210a86668a7dc675627b17ec721e /synapse/rest/client/v1/events.py | |
parent | Add handler for /sync API (diff) | |
parent | Merge pull request #34 from matrix-org/remove_serialize_event_from_hs (diff) | |
download | synapse-3186c5bdbc49cf7cbca3ae0b45bc8657b069a9a8.tar.xz |
Merge branch 'develop' into client_v2_sync
Diffstat (limited to 'synapse/rest/client/v1/events.py')
-rw-r--r-- | synapse/rest/client/v1/events.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/events.py b/synapse/rest/client/v1/events.py index c69de56863..a0d051227b 100644 --- a/synapse/rest/client/v1/events.py +++ b/synapse/rest/client/v1/events.py @@ -19,6 +19,7 @@ from twisted.internet import defer from synapse.api.errors import SynapseError from synapse.streams.config import PaginationConfig from .base import ClientV1RestServlet, client_path_pattern +from synapse.events.utils import serialize_event import logging @@ -64,14 +65,19 @@ class EventStreamRestServlet(ClientV1RestServlet): class EventRestServlet(ClientV1RestServlet): PATTERN = client_path_pattern("/events/(?P<event_id>[^/]*)$") + def __init__(self, hs): + super(EventRestServlet, self).__init__(hs) + self.clock = hs.get_clock() + @defer.inlineCallbacks def on_GET(self, request, event_id): auth_user = yield self.auth.get_user_by_req(request) handler = self.handlers.event_handler event = yield handler.get_event(auth_user, event_id) + time_now = self.clock.time_msec() if event: - defer.returnValue((200, self.hs.serialize_event(event))) + defer.returnValue((200, serialize_event(event, time_now))) else: defer.returnValue((404, "Event not found.")) |