summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2023-04-17 18:57:40 -0600
committerGitHub <noreply@github.com>2023-04-18 00:57:40 +0000
commitaec639e3e33f5ca2f3456c715d28fd7a63c63c8a (patch)
treec5c765186899cd4527e2e57d9c084c8c0691d0fc /synapse/handlers/message.py
parentAdd a note to the config documentation that the 'delete_stale_devices_after' ... (diff)
downloadsynapse-aec639e3e33f5ca2f3456c715d28fd7a63c63c8a.tar.xz
Move Spam Checker callbacks to a dedicated file (#15453)
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index a17fe3bf53..2e964ed37e 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -508,7 +508,7 @@ class EventCreationHandler:
 
         self._bulk_push_rule_evaluator = hs.get_bulk_push_rule_evaluator()
 
-        self.spam_checker = hs.get_spam_checker()
+        self._spam_checker_module_callbacks = hs.get_module_api_callbacks().spam_checker
         self.third_party_event_rules: "ThirdPartyEventRules" = (
             self.hs.get_third_party_event_rules()
         )
@@ -1035,8 +1035,12 @@ class EventCreationHandler:
                     event.sender,
                 )
 
-                spam_check_result = await self.spam_checker.check_event_for_spam(event)
-                if spam_check_result != self.spam_checker.NOT_SPAM:
+                spam_check_result = (
+                    await self._spam_checker_module_callbacks.check_event_for_spam(
+                        event
+                    )
+                )
+                if spam_check_result != self._spam_checker_module_callbacks.NOT_SPAM:
                     if isinstance(spam_check_result, tuple):
                         try:
                             [code, dict] = spam_check_result