summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorShay <hillerys@element.io>2024-01-22 05:59:45 -0800
committerGitHub <noreply@github.com>2024-01-22 13:59:45 +0000
commita68b48a5dd0b617f12677b137742b813a2d805bb (patch)
treec2857be9b019985571cda0e09eea6f2dcd91a409 /synapse
parentBump regex from 1.9.6 to 1.10.3 (#16837) (diff)
downloadsynapse-a68b48a5dd0b617f12677b137742b813a2d805bb.tar.xz
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.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/room.py6
1 files changed, 2 insertions, 4 deletions
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: