summary refs log tree commit diff
path: root/synapse/server.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-05-22 11:56:09 +0100
committerGitHub <noreply@github.com>2018-05-22 11:56:09 +0100
commit8aeb529262ca686b149576f514958a62fb961af1 (patch)
tree794a25f36f274fa857a7bcd5b7c73a2b09723d09 /synapse/server.py
parentMerge pull request #3258 from matrix-org/erikj/fixup_logcontext_rusage (diff)
parentStub out ServerNoticesSender on the workers (diff)
downloadsynapse-8aeb529262ca686b149576f514958a62fb961af1.tar.xz
Merge pull request #3236 from matrix-org/rav/consent_notice
Send users a server notice about consent
Diffstat (limited to 'synapse/server.py')
-rw-r--r--synapse/server.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/server.py b/synapse/server.py
index 85f54cd047..58dbf78437 100644
--- a/synapse/server.py
+++ b/synapse/server.py
@@ -73,6 +73,10 @@ from synapse.rest.media.v1.media_repository import (
     MediaRepositoryResource,
 )
 from synapse.server_notices.server_notices_manager import ServerNoticesManager
+from synapse.server_notices.server_notices_sender import ServerNoticesSender
+from synapse.server_notices.worker_server_notices_sender import (
+    WorkerServerNoticesSender,
+)
 from synapse.state import StateHandler, StateResolutionHandler
 from synapse.storage import DataStore
 from synapse.streams.events import EventSources
@@ -158,6 +162,7 @@ class HomeServer(object):
         'room_member_handler',
         'federation_registry',
         'server_notices_manager',
+        'server_notices_sender',
     ]
 
     def __init__(self, hostname, **kwargs):
@@ -401,8 +406,15 @@ class HomeServer(object):
         return FederationHandlerRegistry()
 
     def build_server_notices_manager(self):
+        if self.config.worker_app:
+            raise Exception("Workers cannot send server notices")
         return ServerNoticesManager(self)
 
+    def build_server_notices_sender(self):
+        if self.config.worker_app:
+            return WorkerServerNoticesSender(self)
+        return ServerNoticesSender(self)
+
     def remove_pusher(self, app_id, push_key, user_id):
         return self.get_pusherpool().remove_pusher(app_id, push_key, user_id)