mirror of
https://github.com/chatmail/core.git
synced 2026-08-18 06:36:29 +03:00
feat: add MsgReadCountChanged event
Useful for updating the read count on channel messages live. This supersedes https://github.com/chatmail/core/pull/7979. Unlike that MR, this one is not breaking. Needed for https://github.com/deltachat/deltachat-desktop/issues/5220.
This commit is contained in:
@@ -181,6 +181,17 @@ pub enum EventType {
|
||||
msg_id: MsgId,
|
||||
},
|
||||
|
||||
/// Like [`EventType::MsgRead`], but also fires on subsequent MDNs,
|
||||
/// if there are multiple receivers, i.e. in groups and channels.
|
||||
#[serde(rename_all = "camelCase")]
|
||||
MsgReadCountChanged {
|
||||
/// ID of the chat which the message belongs to.
|
||||
chat_id: ChatId,
|
||||
|
||||
/// ID of the message that was read.
|
||||
msg_id: MsgId,
|
||||
},
|
||||
|
||||
/// A single message was deleted.
|
||||
///
|
||||
/// This event means that the message will no longer appear in the messagelist.
|
||||
|
||||
@@ -2507,6 +2507,7 @@ async fn handle_mdn(
|
||||
// note(treefit): only matters if it is the last message in chat (but probably too expensive to check, debounce also solves it)
|
||||
chatlist_events::emit_chatlist_item_changed(context, chat_id);
|
||||
}
|
||||
context.emit_event(EventType::MsgReadCountChanged { chat_id, msg_id });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user