Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move call invite filtering logic to filter_events_for_client #17782

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

anoadragon453
Copy link
Member

Fixes #17359. Follow-up to #16908

This allows Simplified Sliding Sync to also filter call invites events in public rooms.

@anoadragon453 anoadragon453 marked this pull request as ready for review October 3, 2024 10:44
@anoadragon453 anoadragon453 requested a review from a team as a code owner October 3, 2024 10:44
This allows SSS to benefit from it as well.
It appears there's an additional DB transaction as the JoinRules state chunk is not cached for these tests.
@@ -117,7 +118,7 @@ async def filter_events_for_client(
[event.event_id for event in events],
)

types = (_HISTORY_VIS_KEY, (EventTypes.Member, user_id))
types = (_HISTORY_VIS_KEY, (EventTypes.Member, user_id), (EventTypes.JoinRules, ""))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter_events_for_client(...) is a pretty slow operation already and a hot path for so many endpoints.

It would be good to conditionally request EventTypes.JoinRules only if we see an event of type EventTypes.CallInvite.

@@ -1181,7 +1181,7 @@ def assert_annotations(bundled_aggregations: JsonDict) -> None:
bundled_aggregations,
)

self._test_bundled_aggregations(RelationTypes.REFERENCE, assert_annotations, 6)
self._test_bundled_aggregations(RelationTypes.REFERENCE, assert_annotations, 7)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To explain this change; the extra database call is because (EventTypes.JoinRules, "") was added to the types we query for in filter_events_for_client(...)

synapse/visibility.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move public room call invite mitigations to filter_events_for_client
2 participants