diff options
author | David Teller <D.O.Teller@gmail.com> | 2020-12-11 20:05:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 14:05:15 -0500 |
commit | f14428b25c37e44675edac4a80d7bd1e47112586 (patch) | |
tree | 7565992e70db2c48c7008b2e3fdfe122d315308e /synapse/handlers/user_directory.py | |
parent | Add type hints to the push module. (#8901) (diff) | |
download | synapse-f14428b25c37e44675edac4a80d7bd1e47112586.tar.xz |
Allow spam-checker modules to be provide async methods. (#8890)
Spam checker modules can now provide async methods. This is implemented in a backwards-compatible manner.
Diffstat (limited to 'synapse/handlers/user_directory.py')
-rw-r--r-- | synapse/handlers/user_directory.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/handlers/user_directory.py b/synapse/handlers/user_directory.py index afbebfc200..f263a638f8 100644 --- a/synapse/handlers/user_directory.py +++ b/synapse/handlers/user_directory.py @@ -81,11 +81,11 @@ class UserDirectoryHandler(StateDeltasHandler): results = await self.store.search_user_dir(user_id, search_term, limit) # Remove any spammy users from the results. - results["results"] = [ - user - for user in results["results"] - if not self.spam_checker.check_username_for_spam(user) - ] + non_spammy_users = [] + for user in results["results"]: + if not await self.spam_checker.check_username_for_spam(user): + non_spammy_users.append(user) + results["results"] = non_spammy_users return results |