From a68b48a5dd0b617f12677b137742b813a2d805bb Mon Sep 17 00:00:00 2001 From: Shay Date: Mon, 22 Jan 2024 05:59:45 -0800 Subject: Allow room creation but not publishing to continue if room publication rules are violated when creating a new room. (#16811) Prior to this PR, if a request to create a public (public as in published to the rooms directory) room violated the room list publication rules set in the [config](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#room_list_publication_rules), the request to create the room was denied and the room was not created. This PR changes the behavior such that when a request to create a room published to the directory violates room list publication rules, the room is still created but the room is not published to the directory. --- synapse/handlers/room.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'synapse') diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index b49b917b6e..84a11a3010 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -916,10 +916,8 @@ class RoomCreationHandler: if not self.config.roomdirectory.is_publishing_room_allowed( user_id, room_id, room_aliases ): - # Let's just return a generic message, as there may be all sorts of - # reasons why we said no. TODO: Allow configurable error messages - # per alias creation rule? - raise SynapseError(403, "Not allowed to publish room") + # allow room creation to continue but do not publish room + await self.store.set_room_is_public(room_id, False) directory_handler = self.hs.get_directory_handler() if room_alias: -- cgit 1.5.1