Allow sending custom data with read receipts

This commit is contained in:
Tulir Asokan 2021-05-18 15:20:00 +03:00
parent b73debdab6
commit e58055271c
2 changed files with 7 additions and 4 deletions

View file

@ -122,7 +122,8 @@ class ReceiptsHandler(BaseHandler):
return True
async def received_client_receipt(
self, room_id: str, receipt_type: str, user_id: str, event_id: str
self, room_id: str, receipt_type: str, user_id: str, event_id: str,
extra_content: Optional[JsonDict] = None,
) -> None:
"""Called when a client tells us a local user has read up to the given
event_id in the room.
@ -132,7 +133,7 @@ class ReceiptsHandler(BaseHandler):
receipt_type=receipt_type,
user_id=user_id,
event_ids=[event_id],
data={"ts": int(self.clock.time_msec())},
data={"ts": int(self.clock.time_msec()), **(extra_content or {})},
)
is_new = await self._handle_new_receipts([receipt])