Repository navigation
[Server Announcements] Implement excluded_user_ids option - #20407
Merged
Merged
Conversation
Base automatically changed from
anoa/server_announcements_config_rooms
to
develop
October 26, 2026 17:20
anoadragon453
force-pushed
the
anoa/server_announcements_exclude_user_ids
branch
from
October 26, 2026 17:20
87b09c4 to
f278d0f
Compare
anoadragon453
marked this pull request as ready for review
October 28, 2026 18:13
anoadragon453
requested review from
reivilibre
and removed request for
a team
October 28, 2026 18:13
Adds a new config option to exclude a given list of users from being proactively pushed events from a given announcement room. Requested by the ESS team at #20344 (comment)
anoadragon453
force-pushed
the
anoa/server_announcements_exclude_user_ids
branch
from
October 28, 2026 18:13
f278d0f to
1a19d4d
Compare
anoadragon453
requested review from
sandhose
and removed request for
reivilibre
October 28, 2026 18:14
sandhose
approved these changes
Nov 3, 2026
Comment on lines
+348
to
+367
| excluded_user_ids = room.get("excluded_user_ids", []) | ||
| if not isinstance(excluded_user_ids, list): | ||
| raise ConfigError( | ||
| "Must be a list", config_path + ("excluded_user_ids",) | ||
| ) | ||
|
|
||
| for excluded_user_index, user_id in enumerate(excluded_user_ids): | ||
| user_config_path = config_path + ( | ||
| "excluded_user_ids", | ||
| f"<item {excluded_user_index}>", | ||
| ) | ||
| if not isinstance(user_id, str) or not UserID.is_valid_strict(user_id): | ||
| raise ConfigError( | ||
| "Must be a valid Matrix user ID", user_config_path | ||
| ) | ||
| if UserID.from_string(user_id).domain != server_name: | ||
| raise ConfigError( | ||
| "Must be a local user: server announcement rooms are not federated", | ||
| user_config_path, | ||
| ) |
Member
There was a problem hiding this comment.
Let's add a check that theres no user that is both in allowed_user_ids and excluded_user_ids at the same time
| ], | ||
| ) | ||
|
|
||
| def test_excluded_user_ids_default(self) -> None: |
Member
There was a problem hiding this comment.
we should also have some tests for invalid configs
sandhose
enabled stacked auto-merge (squash)
November 3, 2026 12:45
Member
|
Merging this as Andrew is on hol and the changes I had to do were pretty minor. Doing the actual implementation in /sync in another PR once this is merged |
sandhose
disabled stacked auto-merge
November 3, 2026 16:50
sandhose
added a commit
that referenced
this pull request
Nov 4, 2026
…sers in legacy sync (#20465) Follow-up to #20407, which added the `excluded_user_ids` option without enforcing it. This makes legacy `/sync` respect it: users listed in a room's `excluded_user_ids` no longer get that room through the synthetic join. They can still read it, as it is world-readable. The cached lookup now maps room ID to config ID, so the per-user filter runs in memory and adds no database query to `/sync`. `get_server_announcement_room_ids()` is kept as a wrapper, so the stacked PRs are unaffected. Known limitation, documented in the config docs: changing the list does not update rooms that clients already have. A newly excluded user keeps the room, which stops updating. A user removed from the list gets new events without the room's state until their next initial sync. I think that's an okay limitation for now, as we don't really expect this list to be used for real users --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #20372, and re-uses the changelog.
Adds a new config option to exclude a given list of users from being proactively pushed events from a given announcement room.
Requested by the ESS team at #20344 (comment)
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.