diff options
author | Patrick Cloke <patrickc@matrix.org> | 2022-07-28 15:41:00 -0400 |
---|---|---|
committer | Patrick Cloke <patrickc@matrix.org> | 2022-08-05 08:18:31 -0400 |
commit | 0cbddc632eebd0c24fcfa4786edae93202421306 (patch) | |
tree | 46051c2700bb405d93b5ebde780b17dee049f885 | |
parent | Return thread receipts down sync. (diff) | |
download | synapse-0cbddc632eebd0c24fcfa4786edae93202421306.tar.xz |
Add an experimental config flag.
-rw-r--r-- | synapse/config/experimental.py | 2 | ||||
-rw-r--r-- | synapse/rest/client/receipts.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/synapse/config/experimental.py b/synapse/config/experimental.py index 0c28182799..9a244e0bc6 100644 --- a/synapse/config/experimental.py +++ b/synapse/config/experimental.py @@ -82,6 +82,8 @@ class ExperimentalConfig(Config): # MSC3786 (Add a default push rule to ignore m.room.server_acl events) self.msc3786_enabled: bool = experimental.get("msc3786_enabled", False) + # MSC3771: Thread read receipts + self.msc3771_enabled: bool = experimental.get("msc3771_enabled", False) # MSC3772: A push rule for mutual relations. self.msc3772_enabled: bool = experimental.get("msc3772_enabled", False) # MSC3773: Thread notifications diff --git a/synapse/rest/client/receipts.py b/synapse/rest/client/receipts.py index 3e4aea065a..15d98a6226 100644 --- a/synapse/rest/client/receipts.py +++ b/synapse/rest/client/receipts.py @@ -16,7 +16,7 @@ import logging from typing import TYPE_CHECKING, Optional, Tuple from synapse.api.constants import ReceiptTypes -from synapse.api.errors import SynapseError +from synapse.api.errors import SynapseError, UnrecognizedRequestError from synapse.http.server import HttpServer from synapse.http.servlet import RestServlet, parse_json_object_from_request from synapse.http.site import SynapseRequest @@ -51,6 +51,8 @@ class ReceiptRestServlet(RestServlet): (ReceiptTypes.READ_PRIVATE, ReceiptTypes.FULLY_READ) ) + self._msc3771_enabled = hs.config.experimental.msc3771_enabled + async def on_POST( self, request: SynapseRequest, @@ -67,6 +69,9 @@ class ReceiptRestServlet(RestServlet): f"Receipt type must be {', '.join(self._known_receipt_types)}", ) + if thread_id and not self._msc3771_enabled: + raise UnrecognizedRequestError() + parse_json_object_from_request(request, allow_empty_body=False) await self.presence_handler.bump_presence_active_time(requester.user) |