summary refs log tree commit diff
path: root/tests/server.py
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2024-05-21 20:09:17 +0000
committerGitHub <noreply@github.com>2024-05-21 20:09:17 +0000
commit6a9a641fb86b04587840bcb6b76af9a0acef9b54 (patch)
treea8c0bace62f61de7b605c23635d85d111abf11d9 /tests/server.py
parentImprove perf of sync device lists (#17216) (diff)
downloadsynapse-6a9a641fb86b04587840bcb6b76af9a0acef9b54.tar.xz
Bring auto-accept invite logic into Synapse (#17147)
This PR ports the logic from the
[synapse_auto_accept_invite](https://github.com/matrix-org/synapse-auto-accept-invite)
module into synapse.

I went with the naive approach of injecting the "module" next to where
third party modules are currently loaded. If there is a better/preferred
way to handle this, I'm all ears. It wasn't obvious to me if there was a
better location to add this logic that would cleanly apply to all
incoming invite events.

Relies on https://github.com/element-hq/synapse/pull/17166 to fix linter
errors.
Diffstat (limited to '')
-rw-r--r--tests/server.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/server.py b/tests/server.py
index 434be3d22c..f3a917f835 100644
--- a/tests/server.py
+++ b/tests/server.py
@@ -85,6 +85,7 @@ from twisted.web.server import Request, Site
 
 from synapse.config.database import DatabaseConnectionConfig
 from synapse.config.homeserver import HomeServerConfig
+from synapse.events.auto_accept_invites import InviteAutoAccepter
 from synapse.events.presence_router import load_legacy_presence_router
 from synapse.handlers.auth import load_legacy_password_auth_providers
 from synapse.http.site import SynapseRequest
@@ -1156,6 +1157,11 @@ def setup_test_homeserver(
     for module, module_config in hs.config.modules.loaded_modules:
         module(config=module_config, api=module_api)
 
+    if hs.config.auto_accept_invites.enabled:
+        # Start the local auto_accept_invites module.
+        m = InviteAutoAccepter(hs.config.auto_accept_invites, module_api)
+        logger.info("Loaded local module %s", m)
+
     load_legacy_spam_checkers(hs)
     load_legacy_third_party_event_rules(hs)
     load_legacy_presence_router(hs)