diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2020-05-01 15:15:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 15:15:36 +0100 |
commit | 6b22921b195c24762cd7c02a8b8fad75791fce70 (patch) | |
tree | 9ee0c395a0904de1e18803fa4238e4ee348d4297 /synapse/server_notices/consent_server_notices.py | |
parent | Further improvements to requesting the public rooms list on a homeserver whic... (diff) | |
download | synapse-6b22921b195c24762cd7c02a8b8fad75791fce70.tar.xz |
async/await is_server_admin (#7363)
Diffstat (limited to 'synapse/server_notices/consent_server_notices.py')
-rw-r--r-- | synapse/server_notices/consent_server_notices.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/synapse/server_notices/consent_server_notices.py b/synapse/server_notices/consent_server_notices.py index 5736c56032..3bf330da49 100644 --- a/synapse/server_notices/consent_server_notices.py +++ b/synapse/server_notices/consent_server_notices.py @@ -16,8 +16,6 @@ import logging from six import iteritems, string_types -from twisted.internet import defer - from synapse.api.errors import SynapseError from synapse.api.urls import ConsentURIBuilder from synapse.config import ConfigError @@ -59,8 +57,7 @@ class ConsentServerNotices(object): self._consent_uri_builder = ConsentURIBuilder(hs.config) - @defer.inlineCallbacks - def maybe_send_server_notice_to_user(self, user_id): + async def maybe_send_server_notice_to_user(self, user_id): """Check if we need to send a notice to this user, and does so if so Args: @@ -78,7 +75,7 @@ class ConsentServerNotices(object): return self._users_in_progress.add(user_id) try: - u = yield self._store.get_user_by_id(user_id) + u = await self._store.get_user_by_id(user_id) if u["is_guest"] and not self._send_to_guests: # don't send to guests @@ -100,8 +97,8 @@ class ConsentServerNotices(object): content = copy_with_str_subst( self._server_notice_content, {"consent_uri": consent_uri} ) - yield self._server_notices_manager.send_notice(user_id, content) - yield self._store.user_set_consent_server_notice_sent( + await self._server_notices_manager.send_notice(user_id, content) + await self._store.user_set_consent_server_notice_sent( user_id, self._current_consent_version ) except SynapseError as e: |