summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2023-03-08 18:44:00 +0000
committerDavid Robertson <davidr@element.io>2023-03-08 19:21:43 +0000
commit7f977832d63388c2db0ff2315f622052af6c9946 (patch)
treec28d205037468ad81bc35b8e7f4735d0db0ceb36
parentUnconditionally omit remote events in partial state rooms (diff)
downloadsynapse-7f977832d63388c2db0ff2315f622052af6c9946.tar.xz
Separate decision from action
-rw-r--r--synapse/visibility.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/visibility.py b/synapse/visibility.py

index 92955fc2ce..d9bd671632 100644 --- a/synapse/visibility.py +++ b/synapse/visibility.py
@@ -668,8 +668,7 @@ async def filter_events_for_server( target_server_name, ) - to_return = [] - for e in events: + def include_event_in_output(e: EventBase) -> bool: erased = is_sender_erased(e, erased_senders) visible = check_event_is_visible( event_to_history_vis[e.event_id], event_to_memberships.get(e.event_id, {}) @@ -678,7 +677,11 @@ async def filter_events_for_server( if e in partial_state_invisible_events: visible = False - if visible and not erased: + return visible and not erased + + to_return = [] + for e in events: + if include_event_in_output(e): to_return.append(e) elif redact: to_return.append(prune_event(e))