mirror of
https://github.com/chatmail/core.git
synced 2026-05-25 01:36:31 +03:00
fix: Tombstone MDN before sending it (#8252)
Otherwise, when it appears on IMAP, it will mark chat messages as seen/noticed even if markfresh_chat() is called meanwhile.
This commit is contained in:
@@ -1371,6 +1371,11 @@ async fn test_markfresh_chat() -> Result<()> {
|
||||
assert_eq!(bob_chat_id.get_fresh_msg_cnt(bob).await?, 0);
|
||||
assert_eq!(bob.get_fresh_msgs().await?.len(), 0);
|
||||
|
||||
// Marking a message as seen results to sending an MDN to the contact and self.
|
||||
message::markseen_msgs(bob, vec![bob_msg2.id]).await?;
|
||||
smtp::queue_mdn(bob).await?;
|
||||
let sent_mdn = bob.pop_sent_msg().await;
|
||||
|
||||
// bob marks the chat as fresh again, fresh count is 1 again
|
||||
markfresh_chat(bob, bob_chat_id).await?;
|
||||
let bob_msg1 = Message::load_from_db(bob, bob_msg1.id).await?;
|
||||
@@ -1380,6 +1385,13 @@ async fn test_markfresh_chat() -> Result<()> {
|
||||
assert_eq!(bob_chat_id.get_fresh_msg_cnt(bob).await?, 1);
|
||||
assert_eq!(bob.get_fresh_msgs().await?.len(), 1);
|
||||
|
||||
// The MDN appears on IMAP, but it shalln't affect the chat.
|
||||
assert!(bob.recv_msg_opt(&sent_mdn).await.is_none());
|
||||
let bob_msg2 = Message::load_from_db(bob, bob_msg2.id).await?;
|
||||
assert_eq!(bob_msg2.state, MessageState::InFresh);
|
||||
assert_eq!(bob_chat_id.get_fresh_msg_cnt(bob).await?, 1);
|
||||
assert_eq!(bob.get_fresh_msgs().await?.len(), 1);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -590,6 +590,7 @@ async fn send_mdn_rfc724_mid(
|
||||
if context.get_config_bool(Config::BccSelf).await? {
|
||||
add_self_recipients(context, &mut recipients, encrypted).await?;
|
||||
}
|
||||
message::insert_tombstone(context, &rendered_msg.rfc724_mid).await?;
|
||||
#[cfg(not(test))]
|
||||
{
|
||||
use crate::log::LogExt;
|
||||
|
||||
Reference in New Issue
Block a user