summary refs log tree commit diff
path: root/synapse/module_api/callbacks/spamchecker_callbacks.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@element.io>2025-02-05 13:07:49 +0100
committerGitHub <noreply@github.com>2025-02-05 12:07:49 +0000
commitb8a333004a9d7591ecf2c477c50e06f122f40565 (patch)
tree09e9581cd1ee170fcc770922ae35874824324e98 /synapse/module_api/callbacks/spamchecker_callbacks.py
parentAdd MSC3861 config options admin_token_path and client_secret_path (#18004) (diff)
downloadsynapse-b8a333004a9d7591ecf2c477c50e06f122f40565.tar.xz
Fix legacy modules `check_username_for_spam` (#18135)
Broke in #17916, as the signature inspection incorrectly looks at the
wrapper function. We fix this by setting the signature on the wrapper
function to that of the wrapped function via `@functools.wraps`.
Diffstat (limited to 'synapse/module_api/callbacks/spamchecker_callbacks.py')
-rw-r--r--synapse/module_api/callbacks/spamchecker_callbacks.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/synapse/module_api/callbacks/spamchecker_callbacks.py b/synapse/module_api/callbacks/spamchecker_callbacks.py

index a2f328cafe..9bc572422b 100644 --- a/synapse/module_api/callbacks/spamchecker_callbacks.py +++ b/synapse/module_api/callbacks/spamchecker_callbacks.py
@@ -19,6 +19,7 @@ # # +import functools import inspect import logging from typing import ( @@ -297,6 +298,7 @@ def load_legacy_spam_checkers(hs: "synapse.server.HomeServer") -> None: "Bad signature for callback check_registration_for_spam", ) + @functools.wraps(wrapped_func) def run(*args: Any, **kwargs: Any) -> Awaitable: # Assertion required because mypy can't prove we won't change `f` # back to `None`. See