mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 04:54:15 -04:00
Uniformize spam-checker API, part 4: port other spam-checker callbacks to return Union[Allow, Codes]
. (#12857)
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
This commit is contained in:
parent
53b77b203a
commit
a164a46038
12 changed files with 604 additions and 182 deletions
|
@ -954,14 +954,12 @@ class EventCreationHandler:
|
|||
"Spam-check module returned invalid error value. Expecting [code, dict], got %s",
|
||||
spam_check_result,
|
||||
)
|
||||
spam_check_result = Codes.FORBIDDEN
|
||||
|
||||
if isinstance(spam_check_result, Codes):
|
||||
raise SynapseError(
|
||||
403,
|
||||
"This message has been rejected as probable spam",
|
||||
spam_check_result,
|
||||
)
|
||||
raise SynapseError(
|
||||
403,
|
||||
"This message has been rejected as probable spam",
|
||||
Codes.FORBIDDEN,
|
||||
)
|
||||
|
||||
# Backwards compatibility: if the return value is not an error code, it
|
||||
# means the module returned an error message to be included in the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue