summary refs log tree commit diff
path: root/synapse/rest/client/v1/events.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-05-15 10:36:30 +0100
committerGitHub <noreply@github.com>2019-05-15 10:36:30 +0100
commit0aba6c82513802822482de6e1e797b07502b92b5 (patch)
tree5da1073792ad81b5d192dce649b8518cd1907b6b /synapse/rest/client/v1/events.py
parentMerge pull request #5184 from matrix-org/erikj/expose_get_events_as_array (diff)
parentUpdate docstring with correct return type (diff)
downloadsynapse-0aba6c82513802822482de6e1e797b07502b92b5.tar.xz
Merge pull request #5183 from matrix-org/erikj/async_serialize_event
Allow client event serialization to be async
Diffstat (limited to 'synapse/rest/client/v1/events.py')
-rw-r--r--synapse/rest/client/v1/events.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/rest/client/v1/events.py b/synapse/rest/client/v1/events.py
index cd9b3bdbd1..c3b0a39ab7 100644
--- a/synapse/rest/client/v1/events.py
+++ b/synapse/rest/client/v1/events.py
@@ -19,7 +19,6 @@ import logging
 from twisted.internet import defer
 
 from synapse.api.errors import SynapseError
-from synapse.events.utils import serialize_event
 from synapse.streams.config import PaginationConfig
 
 from .base import ClientV1RestServlet, client_path_patterns
@@ -84,6 +83,7 @@ class EventRestServlet(ClientV1RestServlet):
         super(EventRestServlet, self).__init__(hs)
         self.clock = hs.get_clock()
         self.event_handler = hs.get_event_handler()
+        self._event_serializer = hs.get_event_client_serializer()
 
     @defer.inlineCallbacks
     def on_GET(self, request, event_id):
@@ -92,7 +92,8 @@ class EventRestServlet(ClientV1RestServlet):
 
         time_now = self.clock.time_msec()
         if event:
-            defer.returnValue((200, serialize_event(event, time_now)))
+            event = yield self._event_serializer.serialize_event(event, time_now)
+            defer.returnValue((200, event))
         else:
             defer.returnValue((404, "Event not found."))