-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Server notices: add an autojoin setting for the notices room #16699
Server notices: add an autojoin setting for the notices room #16699
Conversation
6aa640e
to
818b8ed
Compare
818b8ed
to
e7192ea
Compare
changelog.d/16699.feature
Outdated
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:
Servers should invite the target user rather than automatically join them to the server notice room.
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 a MUST
so I think it should be fine to have a config flag defaulting to false
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.
Co-authored-by: Patrick Cloke <[email protected]>
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, | ||
) | ||
|
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.
I was a bit alarmed by this, because it looks like maybe_invite_user_to_room
is a generic function. But I see from its docstring that it is specifically intended for server notices.
I also wondered if having the initial membership be invite
might be confusing. But the room's join rules presumably require invites, so I think the invite->join transition is inevitable.
On reflection: LGTM.
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 Mathieu, I think this is sensible.
Signed-off-by: Mathieu Velten [email protected]
Pull Request Checklist
(run the linters)