summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorDavid Teller <D.O.Teller@gmail.com>2022-06-13 20:16:16 +0200
committerGitHub <noreply@github.com>2022-06-13 18:16:16 +0000
commita164a46038b0e51142781619db0e6dec8e0c2aaa (patch)
tree5e7016296e6d10953c5f594461262b0fac46bb12 /synapse/handlers/message.py
parentReplace noop background updates with DELETE. (#12954) (diff)
downloadsynapse-a164a46038b0e51142781619db0e6dec8e0c2aaa.tar.xz
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>
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 9b17939163..ad87c41782 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -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