diff --git a/src/chat.rs b/src/chat.rs index ef93c1dc9..b39d81c44 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -3072,6 +3072,7 @@ mod tests { use crate::chatlist::Chatlist; use crate::constants::{DC_GCL_ARCHIVED_ONLY, DC_GCL_NO_SPECIALS}; use crate::contact::Contact; + use crate::dc_receive_imf::dc_receive_imf; use crate::test_utils::TestContext; #[async_std::test] @@ -3844,4 +3845,65 @@ mod tests { assert!(chat_id.is_self_talk(&ctx).await.unwrap()); assert_eq!(blocked, Blocked::Not); } + + #[async_std::test] + async fn test_group_with_removed_message_id() { + // Alice creates a group with Bob, sends a message to bob + let alice = TestContext::new_alice().await; + let bob = TestContext::new_bob().await; + alice + .set_config(Config::ShowEmails, Some("2")) + .await + .unwrap(); + bob.set_config(Config::ShowEmails, Some("2")).await.unwrap(); + + let (contact_id, _) = + Contact::add_or_lookup(&alice, "", "bob@example.net", Origin::ManuallyCreated) + .await + .unwrap(); + let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "grp") + .await + .unwrap(); + let alice_chat = Chat::load_from_db(&alice, alice_chat_id).await.unwrap(); + add_contact_to_chat(&alice, alice_chat_id, contact_id).await; + assert_eq!(get_chat_contacts(&alice, alice_chat_id).await.len(), 2); + send_text_msg(&alice, alice_chat_id, "hi!".to_string()) + .await + .ok(); + assert_eq!(get_chat_msgs(&alice, alice_chat_id, 0, None).await.len(), 1); + + // Alice has an SMTP-server replacing the `Message-ID:`-header (as done eg. by outlook.com). + let msg = alice.pop_sent_msg().await.payload(); + assert_eq!(msg.match_indices("Gr.").count(), 2); + let msg = msg.replace("Message-ID: