diff options
author | Erik Johnston <erik@matrix.org> | 2019-05-09 13:21:57 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-05-14 11:58:01 +0100 |
commit | b54b03f9e1abc1964fe5f00115a165a2b8e10df5 (patch) | |
tree | bb2a357af902fbdfa935da416a6beaedbd5c8a02 /synapse/rest/client/v2_alpha/notifications.py | |
parent | Migrate all tests to use the dict-based config format instead of hanging item... (diff) | |
download | synapse-b54b03f9e1abc1964fe5f00115a165a2b8e10df5.tar.xz |
Allow client event serialization to be async
Diffstat (limited to 'synapse/rest/client/v2_alpha/notifications.py')
-rw-r--r-- | synapse/rest/client/v2_alpha/notifications.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/synapse/rest/client/v2_alpha/notifications.py b/synapse/rest/client/v2_alpha/notifications.py index 2a6ea3df5f..0a1eb0ae45 100644 --- a/synapse/rest/client/v2_alpha/notifications.py +++ b/synapse/rest/client/v2_alpha/notifications.py @@ -17,10 +17,7 @@ import logging from twisted.internet import defer -from synapse.events.utils import ( - format_event_for_client_v2_without_room_id, - serialize_event, -) +from synapse.events.utils import format_event_for_client_v2_without_room_id from synapse.http.servlet import RestServlet, parse_integer, parse_string from ._base import client_v2_patterns @@ -36,6 +33,7 @@ class NotificationsServlet(RestServlet): self.store = hs.get_datastore() self.auth = hs.get_auth() self.clock = hs.get_clock() + self._event_serializer = hs.get_event_client_serializer() @defer.inlineCallbacks def on_GET(self, request): @@ -69,11 +67,11 @@ class NotificationsServlet(RestServlet): "profile_tag": pa["profile_tag"], "actions": pa["actions"], "ts": pa["received_ts"], - "event": serialize_event( + "event": (yield self._event_serializer.serialize_event( notif_events[pa["event_id"]], self.clock.time_msec(), event_format=format_event_for_client_v2_without_room_id, - ), + )), } if pa["room_id"] not in receipts_by_room: |