diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-03-15 14:06:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-15 14:06:05 -0400 |
commit | dda9b7fc4d2e6ca84a1a994a7ff1943b590e71df (patch) | |
tree | 9417b4b937d592daa7cb5ab692017b92df4fb50d /synapse/visibility.py | |
parent | Add tests for database transaction callbacks (#12198) (diff) | |
download | synapse-dda9b7fc4d2e6ca84a1a994a7ff1943b590e71df.tar.xz |
Use the ignored_users table to test event visibility & sync. (#12225)
Instead of fetching the raw account data and re-parsing it. The ignored_users table is a denormalised version of the account data for quick searching.
Diffstat (limited to 'synapse/visibility.py')
-rw-r--r-- | synapse/visibility.py | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/synapse/visibility.py b/synapse/visibility.py index 281cbe4d88..49519eb8f5 100644 --- a/synapse/visibility.py +++ b/synapse/visibility.py @@ -14,12 +14,7 @@ import logging from typing import Dict, FrozenSet, List, Optional -from synapse.api.constants import ( - AccountDataTypes, - EventTypes, - HistoryVisibility, - Membership, -) +from synapse.api.constants import EventTypes, HistoryVisibility, Membership from synapse.events import EventBase from synapse.events.utils import prune_event from synapse.storage import Storage @@ -87,15 +82,8 @@ async def filter_events_for_client( state_filter=StateFilter.from_types(types), ) - ignore_dict_content = await storage.main.get_global_account_data_by_type_for_user( - user_id, AccountDataTypes.IGNORED_USER_LIST - ) - - ignore_list: FrozenSet[str] = frozenset() - if ignore_dict_content: - ignored_users_dict = ignore_dict_content.get("ignored_users", {}) - if isinstance(ignored_users_dict, dict): - ignore_list = frozenset(ignored_users_dict.keys()) + # Get the users who are ignored by the requesting user. + ignore_list = await storage.main.ignored_users(user_id) erased_senders = await storage.main.are_users_erased(e.sender for e in events) |