summary refs log tree commit diff
path: root/synapse/rest/client/v2_alpha/sendtodevice.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-12-05 16:46:37 +0000
committerErik Johnston <erik@matrix.org>2019-12-05 16:56:23 +0000
commit9c41ba4c5fe6e554bc885a1bef8ed51d14ec0f3e (patch)
tree7cf412d3be90fb978f46f8cda68ef210d3d6f7de /synapse/rest/client/v2_alpha/sendtodevice.py
parentMerge pull request #6482 from matrix-org/erikj/port_rest_v1 (diff)
downloadsynapse-9c41ba4c5fe6e554bc885a1bef8ed51d14ec0f3e.tar.xz
Port rest.client.v2
Diffstat (limited to 'synapse/rest/client/v2_alpha/sendtodevice.py')
-rw-r--r--synapse/rest/client/v2_alpha/sendtodevice.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/synapse/rest/client/v2_alpha/sendtodevice.py b/synapse/rest/client/v2_alpha/sendtodevice.py
index d90e52ed1a..501b52fb6c 100644
--- a/synapse/rest/client/v2_alpha/sendtodevice.py
+++ b/synapse/rest/client/v2_alpha/sendtodevice.py
@@ -15,8 +15,6 @@
 
 import logging
 
-from twisted.internet import defer
-
 from synapse.http import servlet
 from synapse.http.servlet import parse_json_object_from_request
 from synapse.logging.opentracing import set_tag, trace
@@ -51,15 +49,14 @@ class SendToDeviceRestServlet(servlet.RestServlet):
             request, self._put, request, message_type, txn_id
         )
 
-    @defer.inlineCallbacks
-    def _put(self, request, message_type, txn_id):
-        requester = yield self.auth.get_user_by_req(request, allow_guest=True)
+    async def _put(self, request, message_type, txn_id):
+        requester = await self.auth.get_user_by_req(request, allow_guest=True)
 
         content = parse_json_object_from_request(request)
 
         sender_user_id = requester.user.to_string()
 
-        yield self.device_message_handler.send_device_message(
+        await self.device_message_handler.send_device_message(
             sender_user_id, message_type, content["messages"]
         )