diff options
author | David Robertson <davidr@element.io> | 2023-03-08 18:12:45 +0000 |
---|---|---|
committer | David Robertson <davidr@element.io> | 2023-03-08 19:19:46 +0000 |
commit | c813f89de6a279349a1d5f4d65095b2130970f8f (patch) | |
tree | 25881a1f7d616faed6f4155f77153278fcd7ea81 /synapse | |
parent | Tweak docstring and type hint (diff) | |
download | synapse-c813f89de6a279349a1d5f4d65095b2130970f8f.tar.xz |
Flip logic and provide better name
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/federation.py | 4 | ||||
-rw-r--r-- | synapse/visibility.py | 9 |
2 files changed, 6 insertions, 7 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 5f2057269d..00448560f6 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -392,7 +392,7 @@ class FederationHandler: get_prev_content=False, ) - # We set `check_history_visibility_only` as we might otherwise get false + # We unset `filter_out_erased_senders` as we might otherwise get false # positives from users having been erased. filtered_extremities = await filter_events_for_server( self._storage_controllers, @@ -400,7 +400,7 @@ class FederationHandler: self.server_name, events_to_check, redact=False, - check_history_visibility_only=True, + filter_out_erased_senders=False, ) if filtered_extremities: extremities_to_request.append(bp.event_id) diff --git a/synapse/visibility.py b/synapse/visibility.py index 28f44fc31a..cb9a2d1e0a 100644 --- a/synapse/visibility.py +++ b/synapse/visibility.py @@ -567,7 +567,7 @@ async def filter_events_for_server( local_server_name: str, events: Sequence[EventBase], redact: bool = True, - check_history_visibility_only: bool = False, + filter_out_erased_senders: bool = True, ) -> List[EventBase]: """Filter a list of events based on whether the target server is allowed to see them. @@ -590,8 +590,7 @@ async def filter_events_for_server( events redact: Controls what to do with events which have been filtered out. If True, include their redacted forms; if False, omit them entirely. - check_history_visibility_only: Whether to only check the - history visibility, rather than things like if the sender has been + filter_out_erased_senders: If true, also filter out events whose sender has been erased. This is used e.g. during pagination to decide whether to backfill or not. @@ -628,7 +627,7 @@ async def filter_events_for_server( # server has no users in the room: redact return False - if not check_history_visibility_only: + if filter_out_erased_senders: erased_senders = await storage.main.are_users_erased(e.sender for e in events) else: # We don't want to check whether users are erased, which is equivalent @@ -644,7 +643,7 @@ async def filter_events_for_server( # this check but would base the filtering on an outdated view of the membership events. partial_state_invisible_events = set() - if not check_history_visibility_only: + if filter_out_erased_senders: for e in events: sender_domain = get_domain_from_id(e.sender) if ( |