summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-07-16 15:12:54 +0100
committerGitHub <noreply@github.com>2020-07-16 15:12:54 +0100
commitf2e38ca86711a8f80cf45d3182e426ed8967fc81 (patch)
tree5a46223ed7b3e50f018d96a09776b7e442619377 /synapse/rest
parentAdd ability to run multiple pusher instances (#7855) (diff)
downloadsynapse-f2e38ca86711a8f80cf45d3182e426ed8967fc81.tar.xz
Allow moving typing off master (#7869)
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v1/room.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py
index ea5912d4e4..26d5a51cb2 100644
--- a/synapse/rest/client/v1/room.py
+++ b/synapse/rest/client/v1/room.py
@@ -817,9 +817,18 @@ class RoomTypingRestServlet(RestServlet):
         self.typing_handler = hs.get_typing_handler()
         self.auth = hs.get_auth()
 
+        # If we're not on the typing writer instance we should scream if we get
+        # requests.
+        self._is_typing_writer = (
+            hs.config.worker.writers.typing == hs.get_instance_name()
+        )
+
     async def on_PUT(self, request, room_id, user_id):
         requester = await self.auth.get_user_by_req(request)
 
+        if not self._is_typing_writer:
+            raise Exception("Got /typing request on instance that is not typing writer")
+
         room_id = urlparse.unquote(room_id)
         target_user = UserID.from_string(urlparse.unquote(user_id))