diff options
author | Erik Johnston <erik@matrix.org> | 2019-10-29 15:08:22 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-10-29 15:08:22 +0000 |
commit | 2c35ffead257171d195f228bafd0d65b917e2165 (patch) | |
tree | f34e80db36883adfc9623079f72f847def223ae5 /synapse/rest/client/v2_alpha/receipts.py | |
parent | Make concurrently_execute work with async/await (diff) | |
download | synapse-2c35ffead257171d195f228bafd0d65b917e2165.tar.xz |
Port receipt and read markers to async/wait
Diffstat (limited to 'synapse/rest/client/v2_alpha/receipts.py')
-rw-r--r-- | synapse/rest/client/v2_alpha/receipts.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/synapse/rest/client/v2_alpha/receipts.py b/synapse/rest/client/v2_alpha/receipts.py index 0dab03d227..92555bd4a9 100644 --- a/synapse/rest/client/v2_alpha/receipts.py +++ b/synapse/rest/client/v2_alpha/receipts.py @@ -15,8 +15,6 @@ import logging -from twisted.internet import defer - from synapse.api.errors import SynapseError from synapse.http.servlet import RestServlet @@ -39,16 +37,15 @@ class ReceiptRestServlet(RestServlet): self.receipts_handler = hs.get_receipts_handler() self.presence_handler = hs.get_presence_handler() - @defer.inlineCallbacks - def on_POST(self, request, room_id, receipt_type, event_id): - requester = yield self.auth.get_user_by_req(request) + async def on_POST(self, request, room_id, receipt_type, event_id): + requester = await self.auth.get_user_by_req(request) if receipt_type != "m.read": raise SynapseError(400, "Receipt type must be 'm.read'") - yield self.presence_handler.bump_presence_active_time(requester.user) + await self.presence_handler.bump_presence_active_time(requester.user) - yield self.receipts_handler.received_client_receipt( + await self.receipts_handler.received_client_receipt( room_id, receipt_type, user_id=requester.user.to_string(), event_id=event_id ) |