diff options
author | Richard van der Hoff <richard@matrix.org> | 2019-10-18 12:35:13 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2019-10-18 12:35:13 +0100 |
commit | 2b22faded76d8813d1145ac673eca16e9787f6ce (patch) | |
tree | e33a517f865be8f2113ddfead3f24c6b83faef4a /synapse/rest/admin/server_notice_servlet.py | |
parent | Merge remote-tracking branch 'origin/develop' into rav/event_auth/1 (diff) | |
parent | Fix logging config for the docker image (#6197) (diff) | |
download | synapse-2b22faded76d8813d1145ac673eca16e9787f6ce.tar.xz |
Merge remote-tracking branch 'origin/develop' into rav/event_auth/1
Diffstat (limited to 'synapse/rest/admin/server_notice_servlet.py')
-rw-r--r-- | synapse/rest/admin/server_notice_servlet.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/synapse/rest/admin/server_notice_servlet.py b/synapse/rest/admin/server_notice_servlet.py index ae2cbe2e0a..6e9a874121 100644 --- a/synapse/rest/admin/server_notice_servlet.py +++ b/synapse/rest/admin/server_notice_servlet.py @@ -14,8 +14,6 @@ # limitations under the License. import re -from twisted.internet import defer - from synapse.api.constants import EventTypes from synapse.api.errors import SynapseError from synapse.http.servlet import ( @@ -69,9 +67,8 @@ class SendServerNoticeServlet(RestServlet): self.__class__.__name__, ) - @defer.inlineCallbacks - def on_POST(self, request, txn_id=None): - yield assert_requester_is_admin(self.auth, request) + async def on_POST(self, request, txn_id=None): + await assert_requester_is_admin(self.auth, request) body = parse_json_object_from_request(request) assert_params_in_dict(body, ("user_id", "content")) event_type = body.get("type", EventTypes.Message) @@ -85,7 +82,7 @@ class SendServerNoticeServlet(RestServlet): if not self.hs.is_mine_id(user_id): raise SynapseError(400, "Server notices can only be sent to local users") - event = yield self.snm.send_notice( + event = await self.snm.send_notice( user_id=body["user_id"], type=event_type, state_key=state_key, |