diff options
author | Patrick Cloke <patrickc@matrix.org> | 2022-05-26 16:02:45 -0400 |
---|---|---|
committer | Patrick Cloke <patrickc@matrix.org> | 2022-06-13 09:57:05 -0400 |
commit | 82166cfa51fb7565f59a7763ceba05dfd8978d51 (patch) | |
tree | b2efc586060e9b3388af2fb08ea0ef8ac9337109 | |
parent | Accept a start & end event ID when creating a receipt. (diff) | |
download | synapse-82166cfa51fb7565f59a7763ceba05dfd8978d51.tar.xz |
Accept an optional starting event ID for the /receipts API.
-rw-r--r-- | synapse/rest/client/receipts.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/synapse/rest/client/receipts.py b/synapse/rest/client/receipts.py index f1acd42f5e..9c485bd908 100644 --- a/synapse/rest/client/receipts.py +++ b/synapse/rest/client/receipts.py @@ -13,7 +13,7 @@ # limitations under the License. import logging -from typing import TYPE_CHECKING, Tuple +from typing import TYPE_CHECKING, Optional, Tuple from synapse.api.constants import ReceiptTypes from synapse.api.errors import SynapseError @@ -34,7 +34,8 @@ class ReceiptRestServlet(RestServlet): PATTERNS = client_patterns( "/rooms/(?P<room_id>[^/]*)" "/receipt/(?P<receipt_type>[^/]*)" - "/(?P<event_id>[^/]*)$" + "/(?P<end_event_id>[^/]*)" + "(/(?P<start_event_id>[^/]*))?$" ) def __init__(self, hs: "HomeServer"): @@ -46,7 +47,12 @@ class ReceiptRestServlet(RestServlet): self.presence_handler = hs.get_presence_handler() async def on_POST( - self, request: SynapseRequest, room_id: str, receipt_type: str, event_id: str + self, + request: SynapseRequest, + room_id: str, + receipt_type: str, + end_event_id: str, + start_event_id: Optional[str] = None, ) -> Tuple[int, JsonDict]: requester = await self.auth.get_user_by_req(request) @@ -73,14 +79,15 @@ class ReceiptRestServlet(RestServlet): await self.read_marker_handler.received_client_read_marker( room_id, user_id=requester.user.to_string(), - event_id=event_id, + event_id=end_event_id, ) else: await self.receipts_handler.received_client_receipt( room_id, receipt_type, user_id=requester.user.to_string(), - end_event_id=event_id, + end_event_id=end_event_id, + start_event_id=start_event_id, ) return 200, {} |