summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-04-15 18:55:01 +0100
committerGitHub <noreply@github.com>2019-04-15 18:55:01 +0100
commit6e27a8620fc00cab30c087b7700c8b3713f687ab (patch)
treefeeb06e022642e28a0d1c80f2514052208f4b91b /synapse/rest
parentupdate grafana dashboard (diff)
parentOnly handle GET requests for /push_rules (diff)
downloadsynapse-6e27a8620fc00cab30c087b7700c8b3713f687ab.tar.xz
Merge pull request #5063 from matrix-org/erikj/move_endpoints
Move some rest endpoints to client reader
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v1/push_rule.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/rest/client/v1/push_rule.py b/synapse/rest/client/v1/push_rule.py
index c654f9b5f0..7e9d95de26 100644
--- a/synapse/rest/client/v1/push_rule.py
+++ b/synapse/rest/client/v1/push_rule.py
@@ -39,9 +39,13 @@ class PushRuleRestServlet(ClientV1RestServlet):
         super(PushRuleRestServlet, self).__init__(hs)
         self.store = hs.get_datastore()
         self.notifier = hs.get_notifier()
+        self._is_worker = hs.config.worker_app is not None
 
     @defer.inlineCallbacks
     def on_PUT(self, request):
+        if self._is_worker:
+            raise Exception("Cannot handle PUT /push_rules on worker")
+
         spec = _rule_spec_from_path([x.decode('utf8') for x in request.postpath])
         try:
             priority_class = _priority_class_from_spec(spec)
@@ -103,6 +107,9 @@ class PushRuleRestServlet(ClientV1RestServlet):
 
     @defer.inlineCallbacks
     def on_DELETE(self, request):
+        if self._is_worker:
+            raise Exception("Cannot handle DELETE /push_rules on worker")
+
         spec = _rule_spec_from_path([x.decode('utf8') for x in request.postpath])
 
         requester = yield self.auth.get_user_by_req(request)