diff options
author | Mathieu Velten <matmaul@gmail.com> | 2023-12-04 13:31:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 12:31:42 +0000 |
commit | 9e7f80037d08619cdd193831540d34e9ed5aacd7 (patch) | |
tree | 6571e3ff2821fb876e3b37fe57ee15a20b0a8ca8 /synapse/server_notices | |
parent | Bump matrix-org/netlify-pr-preview from 2 to 3 (#16719) (diff) | |
download | synapse-9e7f80037d08619cdd193831540d34e9ed5aacd7.tar.xz |
Server notices: add an autojoin setting for the notices room (#16699)
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Diffstat (limited to 'synapse/server_notices')
-rw-r--r-- | synapse/server_notices/server_notices_manager.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/synapse/server_notices/server_notices_manager.py b/synapse/server_notices/server_notices_manager.py index 44b999677a..2353b5d47f 100644 --- a/synapse/server_notices/server_notices_manager.py +++ b/synapse/server_notices/server_notices_manager.py @@ -224,14 +224,27 @@ class ServerNoticesManager: 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, + ) + async def _update_notice_user_profile_if_changed( self, requester: Requester, |