diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 07b1ac483..93f24fe0f 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -733,7 +733,7 @@ async fn add_parts( create_blocked_default }; - if chat_id.is_none() { + if chat_id.is_none() && !is_mdn { // try to create a group if let Some((new_chat_id, new_chat_id_blocked)) = create_or_lookup_group( diff --git a/src/receive_imf/tests.rs b/src/receive_imf/tests.rs index 6a561ef5c..a9c912714 100644 --- a/src/receive_imf/tests.rs +++ b/src/receive_imf/tests.rs @@ -310,6 +310,56 @@ async fn test_read_receipt_and_unarchive() -> Result<()> { Ok(()) } +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn test_mdn_and_alias() -> Result<()> { + let mut tcm = TestContextManager::new(); + let alice = tcm.alice().await; + let bob = tcm.bob().await; + let alice_chat = alice.create_chat(&bob).await; + let sent = alice.send_text(alice_chat.id, "alice -> bob").await; + let msg_id = sent.sender_msg_id; + receive_imf( + &alice, + format!( + "Received: (Postfix, from userid 1000); Mon, 4 Dec 2006 14:51:39 +0100 (CET)\n\ + From: bob@example.net\n\ + To: alicechat@example.org\n\ + Subject: message opened\n\ + Date: Sun, 22 Mar 2020 23:37:57 +0000\n\ + Chat-Version: 1.0\n\ + Message-ID: \n\ + Content-Type: multipart/report; report-type=disposition-notification; boundary=\"SNIPP\"\n\ + \n\ + \n\ + --SNIPP\n\ + Content-Type: text/plain; charset=utf-8\n\ + \n\ + Read receipts do not guarantee sth. was read.\n\ + \n\ + \n\ + --SNIPP\n\ + Content-Type: message/disposition-notification\n\ + \n\ + Reporting-UA: Delta Chat 1.28.0\n\ + Original-Recipient: rfc822;bob@example.com\n\ + Final-Recipient: rfc822;bob@example.com\n\ + Original-Message-ID: <{msg_id}>\n\ + Disposition: manual-action/MDN-sent-automatically; displayed\n\ + \n\ + \n\ + --SNIPP--", + ) + .as_bytes(), + false, + ) + .await?; + + let chats = Chatlist::try_load(&alice, 0, None, None).await?; + assert_eq!(chats.len(), 1); + + Ok(()) +} + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_no_from() { // if there is no from given, from_id stays 0 which is just fine. These messages