Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11672.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return an `M_FORBIDDEN` error code instead of `M_UNKNOWN` when a spam checker module prevents a user from creating a room.
8 changes: 6 additions & 2 deletions synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,9 @@ async def clone_existing_room(
user_id = requester.user.to_string()

if not await self.spam_checker.user_may_create_room(user_id):
raise SynapseError(403, "You are not permitted to create rooms")
raise SynapseError(
403, "You are not permitted to create rooms", Codes.FORBIDDEN
)

creation_content: JsonDict = {
"room_version": new_room_version.identifier,
Expand Down Expand Up @@ -685,7 +687,9 @@ async def create_room(
invite_3pid_list,
)
):
raise SynapseError(403, "You are not permitted to create rooms")
raise SynapseError(
403, "You are not permitted to create rooms", Codes.FORBIDDEN
)

if ratelimit:
await self.request_ratelimiter.ratelimit(requester)
Expand Down