1
0

Add explicit option for partial state rooms

This commit is contained in:
David Robertson
2023-03-10 12:08:17 +00:00
parent 909eecb348
commit 85a98b1023
4 changed files with 14 additions and 2 deletions
@@ -548,6 +548,7 @@ class PerDestinationQueue:
new_pdus,
redact=False,
filter_out_erased_senders=True,
filter_out_partial_state_rooms=True,
)
# If we've filtered out all the extremities, fall back to
+4
View File
@@ -401,6 +401,7 @@ class FederationHandler:
events_to_check,
redact=False,
filter_out_erased_senders=False,
filter_out_partial_state_rooms=False,
)
if filtered_extremities:
extremities_to_request.append(bp.event_id)
@@ -1337,6 +1338,7 @@ class FederationHandler:
events,
redact=True,
filter_out_erased_senders=True,
filter_out_partial_state_rooms=True,
)
return events
@@ -1373,6 +1375,7 @@ class FederationHandler:
[event],
redact=True,
filter_out_erased_senders=True,
filter_out_partial_state_rooms=True,
)
event = events[0]
return event
@@ -1406,6 +1409,7 @@ class FederationHandler:
missing_events,
redact=True,
filter_out_erased_senders=True,
filter_out_partial_state_rooms=True,
)
return missing_events
+4 -2
View File
@@ -579,6 +579,7 @@ async def filter_events_for_server(
*,
redact: bool,
filter_out_erased_senders: bool,
filter_out_partial_state_rooms: bool,
) -> List[EventBase]:
"""Filter a list of events based on whether the target server is allowed to
see them.
@@ -604,7 +605,8 @@ async def filter_events_for_server(
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.
filter_out_partial_state_rooms: If True, also filter out events in partial state
rooms.
Returns
The filtered events.
"""
@@ -654,7 +656,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_event_ids: Set[str] = set()
if filter_out_erased_senders:
if filter_out_partial_state_rooms:
for e in events:
sender_domain = get_domain_from_id(e.sender)
if (
+5
View File
@@ -69,6 +69,7 @@ class FilterEventsForServerTestCase(unittest.HomeserverTestCase):
events_to_filter,
redact=True,
filter_out_erased_senders=True,
filter_out_partial_state_rooms=True,
)
)
@@ -96,6 +97,7 @@ class FilterEventsForServerTestCase(unittest.HomeserverTestCase):
[outlier],
redact=True,
filter_out_erased_senders=True,
filter_out_partial_state_rooms=True,
)
),
[outlier],
@@ -112,6 +114,7 @@ class FilterEventsForServerTestCase(unittest.HomeserverTestCase):
[outlier, evt],
redact=True,
filter_out_erased_senders=True,
filter_out_partial_state_rooms=True,
)
)
self.assertEqual(len(filtered), 2, f"expected 2 results, got: {filtered}")
@@ -129,6 +132,7 @@ class FilterEventsForServerTestCase(unittest.HomeserverTestCase):
[outlier, evt],
redact=True,
filter_out_erased_senders=True,
filter_out_partial_state_rooms=True,
)
)
self.assertEqual(filtered[0], outlier)
@@ -169,6 +173,7 @@ class FilterEventsForServerTestCase(unittest.HomeserverTestCase):
events_to_filter,
redact=True,
filter_out_erased_senders=True,
filter_out_partial_state_rooms=True,
)
)