Skip to content

Add support for MSC4155 Invite filtering #18288

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

Merged
merged 43 commits into from
Jun 5, 2025

Conversation

Half-Shot
Copy link
Member

@Half-Shot Half-Shot commented Mar 27, 2025

This implements matrix-org/matrix-spec-proposals#4155, which adds support for a new account data type that blocks an invite based on some conditions in the event contents.

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct
    (run the linters)

@Half-Shot Half-Shot changed the title Implementation of MSC4155 Add support for MSC4155 Invite filtering Mar 27, 2025
@Half-Shot Half-Shot marked this pull request as ready for review March 31, 2025 12:56
@Half-Shot Half-Shot requested a review from a team as a code owner March 31, 2025 12:56
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

This is a good start! Apologies for the long turn-around time on reviews.

Could you also write some Complement tests for this? Given it's related to an MSC, it'd be good to have homeserver-level integration tests for it, assuming it eventually passes FCP.

Comment on lines 1081 to 1092
"""
Get the invite configuration for the current user.

If experimental MSC3391 support is enabled, any entries with an empty
content body are excluded; as this means they have been deleted.

Args:
user_id: The user to get the account_data for.

Returns:
The global account_data.
"""
Copy link
Member

Choose a reason for hiding this comment

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

This docstring needs to be updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

How strict are we on providing args and returns here. Both are fairly self explanatory?

Copy link
Member

Choose a reason for hiding this comment

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

Currently we do it even for self-explanatory arguments, though we'll write:

Args:
    user_id: 

whether that's necessary is another conversation, but that's the current convention.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done and done for public APIs

@Half-Shot Half-Shot force-pushed the hs/msc4155-invite-filtering branch from a248274 to 729567f Compare May 22, 2025 05:57
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

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

drive-by SCT review of the implementation

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

A few more things, but we're getting close now! Thanks for being persistent with this one.

@Half-Shot Half-Shot requested a review from anoadragon453 June 4, 2025 11:09
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

This LGTM now, thanks!

Edit: Sytest failures appear to be unrelated to this PR.

@Half-Shot
Copy link
Member Author

@anoadragon453 just FYI you'll be clicking merge because I lack perms :)

@@ -137,6 +137,9 @@ class Codes(str, Enum):
PROFILE_TOO_LARGE = "M_PROFILE_TOO_LARGE"
KEY_TOO_LARGE = "M_KEY_TOO_LARGE"

# Part of MSC4155
INVITE_BLOCKED = "ORG.MATRIX.MSC4155.M_INVITE_BLOCKED"
Copy link
Member Author

Choose a reason for hiding this comment

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

@reivilibre reivilibre merged commit 8010377 into element-hq:develop Jun 5, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants