summary refs log tree commit diff
path: root/synapse/rest/client/receipts.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-10-07 09:26:40 -0400
committerGitHub <noreply@github.com>2022-10-07 09:26:40 -0400
commit66a785733458d0b5801097caff53624e202a91b4 (patch)
treeef211ad0fefd409961a03cd0ec8a0fd5b0a5e951 /synapse/rest/client/receipts.py
parentAdd sample worker files for `pusher` and `federation_sender` (#14077) (diff)
downloadsynapse-66a785733458d0b5801097caff53624e202a91b4.tar.xz
Use stable identifiers for MSC3771 & MSC3773. (#14050)
These are both part of Matrix 1.4 which has now been released.

For now, support both the unstable and stable identifiers.
Diffstat (limited to 'synapse/rest/client/receipts.py')
-rw-r--r--synapse/rest/client/receipts.py48
1 files changed, 23 insertions, 25 deletions
diff --git a/synapse/rest/client/receipts.py b/synapse/rest/client/receipts.py
index 287dfdd69e..14dec7ac4e 100644
--- a/synapse/rest/client/receipts.py
+++ b/synapse/rest/client/receipts.py
@@ -50,7 +50,6 @@ class ReceiptRestServlet(RestServlet):
             ReceiptTypes.READ_PRIVATE,
             ReceiptTypes.FULLY_READ,
         }
-        self._msc3771_enabled = hs.config.experimental.msc3771_enabled
 
     async def on_POST(
         self, request: SynapseRequest, room_id: str, receipt_type: str, event_id: str
@@ -67,30 +66,29 @@ class ReceiptRestServlet(RestServlet):
 
         # Pull the thread ID, if one exists.
         thread_id = None
-        if self._msc3771_enabled:
-            if "thread_id" in body:
-                thread_id = body.get("thread_id")
-                if not thread_id or not isinstance(thread_id, str):
-                    raise SynapseError(
-                        400,
-                        "thread_id field must be a non-empty string",
-                        Codes.INVALID_PARAM,
-                    )
-
-                if receipt_type == ReceiptTypes.FULLY_READ:
-                    raise SynapseError(
-                        400,
-                        f"thread_id is not compatible with {ReceiptTypes.FULLY_READ} receipts.",
-                        Codes.INVALID_PARAM,
-                    )
-
-                # Ensure the event ID roughly correlates to the thread ID.
-                if thread_id != await self._main_store.get_thread_id(event_id):
-                    raise SynapseError(
-                        400,
-                        f"event_id {event_id} is not related to thread {thread_id}",
-                        Codes.INVALID_PARAM,
-                    )
+        if "thread_id" in body:
+            thread_id = body.get("thread_id")
+            if not thread_id or not isinstance(thread_id, str):
+                raise SynapseError(
+                    400,
+                    "thread_id field must be a non-empty string",
+                    Codes.INVALID_PARAM,
+                )
+
+            if receipt_type == ReceiptTypes.FULLY_READ:
+                raise SynapseError(
+                    400,
+                    f"thread_id is not compatible with {ReceiptTypes.FULLY_READ} receipts.",
+                    Codes.INVALID_PARAM,
+                )
+
+            # Ensure the event ID roughly correlates to the thread ID.
+            if thread_id != await self._main_store.get_thread_id(event_id):
+                raise SynapseError(
+                    400,
+                    f"event_id {event_id} is not related to thread {thread_id}",
+                    Codes.INVALID_PARAM,
+                )
 
         await self.presence_handler.bump_presence_active_time(requester.user)