This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Server notices: add an autojoin setting for the notices room #16699
Merged
DMRobertson
merged 5 commits into
matrix-org:develop
from
MatMaul:server-notice-autojoin
Dec 4, 2023
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e7192ea
Server notices: add an autojoin setting for the notices room
MatMaul 8597dd1
Update tests/rest/admin/test_server_notice.py
MatMaul 7187ad3
comments
MatMaul a7084fd
Tweak docs wording
DMRobertson 6224155
Fix docs spacing
DMRobertson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add an autojoin setting for the notices room so users get joined directly instead of receiving an invite. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,14 +224,27 @@ async def maybe_invite_user_to_room(self, user_id: str, room_id: str) -> None: | |
if room.room_id == room_id: | ||
return | ||
|
||
user_id_obj = UserID.from_string(user_id) | ||
await self._room_member_handler.update_membership( | ||
requester=requester, | ||
target=UserID.from_string(user_id), | ||
target=user_id_obj, | ||
room_id=room_id, | ||
action="invite", | ||
ratelimit=False, | ||
) | ||
|
||
if self._config.servernotices.server_notices_auto_join: | ||
user_requester = create_requester( | ||
user_id, authenticated_entity=self._server_name | ||
) | ||
await self._room_member_handler.update_membership( | ||
requester=user_requester, | ||
target=user_id_obj, | ||
room_id=room_id, | ||
action="join", | ||
ratelimit=False, | ||
) | ||
|
||
Comment on lines
+236
to
+247
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was a bit alarmed by this, because it looks like I also wondered if having the initial membership be On reflection: LGTM. |
||
async def _update_notice_user_profile_if_changed( | ||
self, | ||
requester: Requester, | ||
|
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW this is against the spec:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, TIL server notices is specced :)
It's a
SHOULD
and not aMUST
so I think it should be fine to have a config flag defaulting tofalse
for that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's probably fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I don't understand the spec's rationale and I think that auto-joining makes for a better UX.