summary refs log tree commit diff
path: root/synapse/rest/client/v1/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-05-09 13:21:57 +0100
committerErik Johnston <erik@matrix.org>2019-05-14 11:58:01 +0100
commitb54b03f9e1abc1964fe5f00115a165a2b8e10df5 (patch)
treebb2a357af902fbdfa935da416a6beaedbd5c8a02 /synapse/rest/client/v1/events.py
parentMigrate all tests to use the dict-based config format instead of hanging item... (diff)
downloadsynapse-b54b03f9e1abc1964fe5f00115a165a2b8e10df5.tar.xz
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."))