Outbound read receipts
This commit is contained in:
parent
109e9bcc67
commit
4a68796fdf
|
@ -355,6 +355,17 @@ class Client:
|
|||
chat_id=chat_id.serialize(),
|
||||
)
|
||||
|
||||
async def mark_read(
|
||||
self,
|
||||
channel_props: ChannelProps,
|
||||
read_until_chat_id: Long,
|
||||
) -> None:
|
||||
return await self._api_user_request_void(
|
||||
"mark_read",
|
||||
channel_props=channel_props.serialize(),
|
||||
read_until_chat_id=read_until_chat_id.serialize(),
|
||||
)
|
||||
|
||||
|
||||
# TODO Combine these into one
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ from mautrix.types import (
|
|||
EventType,
|
||||
ReactionEvent,
|
||||
ReactionEventContent,
|
||||
ReceiptEvent,
|
||||
RedactionEvent,
|
||||
RelationType,
|
||||
RoomID,
|
||||
|
@ -32,6 +33,7 @@ from mautrix.types import (
|
|||
)
|
||||
|
||||
from . import portal as po, user as u
|
||||
from .db import Message as DBMessage
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .__main__ import KakaoTalkBridge
|
||||
|
@ -153,19 +155,16 @@ class MatrixHandler(BaseMatrixHandler):
|
|||
event_id: EventID,
|
||||
data: SingleReceiptEventContent,
|
||||
) -> None:
|
||||
self.log.info("TODO: handle_read_receipt")
|
||||
"""
|
||||
if not user.mqtt:
|
||||
if not user.is_connected:
|
||||
return
|
||||
timestamp = data.get("ts", int(time.time() * 1000))
|
||||
message = await DBMessage.get_by_mxid(event_id, portal.mxid)
|
||||
await user.mqtt.mark_read(
|
||||
portal.ktid,
|
||||
True, # TODO
|
||||
#portal.fb_type != ThreadType.USER,
|
||||
read_to=message.timestamp if message else timestamp,
|
||||
)
|
||||
"""
|
||||
await user.client.mark_read(portal.channel_props, message.ktid)
|
||||
|
||||
async def handle_ephemeral_event(
|
||||
self, evt: ReceiptEvent | Event
|
||||
) -> None:
|
||||
if evt.type == EventType.RECEIPT:
|
||||
await self.handle_receipt(evt)
|
||||
|
||||
async def handle_event(self, evt: Event) -> None:
|
||||
if evt.type == EventType.ROOM_REDACTION:
|
||||
|
|
|
@ -605,6 +605,20 @@ export default class PeerClient {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} req
|
||||
* @param {string} req.mxid
|
||||
* @param {ChannelProps} req.channel_props
|
||||
* @param {Long} req.read_until_chat_id
|
||||
*/
|
||||
markRead = async (req) => {
|
||||
const talkChannel = await this.#getUserChannel(req.mxid, req.channel_props)
|
||||
|
||||
return await talkChannel.markRead({
|
||||
logId: req.read_until_chat_id,
|
||||
})
|
||||
}
|
||||
|
||||
#makeCommandResult(result) {
|
||||
return {
|
||||
success: true,
|
||||
|
|
Loading…
Reference in New Issue