mirror of
https://github.com/element-hq/synapse.git
synced 2025-03-05 15:37:02 +00:00
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`.
This commit is contained in:
parent
e41174cae3
commit
b8a333004a
2 changed files with 3 additions and 0 deletions
1
changelog.d/18135.bugfix
Normal file
1
changelog.d/18135.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix user directory search when using a legacy module with a `check_username_for_spam` callback. Broke in v1.122.0.
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue