mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Make room creations denied by user_may_create_room
cause an M_FORBIDDEN
error to be returned, not M_UNKNOWN
(#11672)
Co-authored-by: reivilibre <olivier@librepush.net>
This commit is contained in:
parent
c9eb678b73
commit
2ef1fea8d2
1
changelog.d/11672.feature
Normal file
1
changelog.d/11672.feature
Normal file
@ -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.
|
@ -393,7 +393,9 @@ class RoomCreationHandler:
|
|||||||
user_id = requester.user.to_string()
|
user_id = requester.user.to_string()
|
||||||
|
|
||||||
if not await self.spam_checker.user_may_create_room(user_id):
|
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 = {
|
creation_content: JsonDict = {
|
||||||
"room_version": new_room_version.identifier,
|
"room_version": new_room_version.identifier,
|
||||||
@ -685,7 +687,9 @@ class RoomCreationHandler:
|
|||||||
invite_3pid_list,
|
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:
|
if ratelimit:
|
||||||
await self.request_ratelimiter.ratelimit(requester)
|
await self.request_ratelimiter.ratelimit(requester)
|
||||||
|
Loading…
Reference in New Issue
Block a user