mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
add failing test for mailinglists with footer in an extra mimepart
This commit is contained in:
@@ -2024,7 +2024,7 @@ fn dc_create_incoming_rfc724_mid(
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::chat::{ChatItem, ChatVisibility};
|
||||
use crate::chat::{get_chat_msgs, ChatItem, ChatVisibility};
|
||||
use crate::chatlist::Chatlist;
|
||||
use crate::constants::{DC_CHAT_ID_DEADDROP, DC_CONTACT_ID_INFO, DC_GCL_NO_SPECIALS};
|
||||
use crate::message::ContactRequestDecision::*;
|
||||
@@ -3112,6 +3112,42 @@ mod tests {
|
||||
assert_eq!(chat.name, "DPD");
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
async fn test_mailing_list_with_mimepart_footer() {
|
||||
let t = TestContext::new_alice().await;
|
||||
t.set_config(Config::ShowEmails, Some("2")).await.unwrap();
|
||||
let deaddrop = ChatId::new(DC_CHAT_ID_DEADDROP);
|
||||
assert_eq!(get_chat_msgs(&t, deaddrop, 0, None).await.len(), 0);
|
||||
|
||||
// the mailing list message contains two top-level texts.
|
||||
// the second text is a footer that is added by some mailing list software
|
||||
// if the user-edited text contains html.
|
||||
// this footer should not become a text-message in delta chat
|
||||
// (otherwise every second mail might be the same footer)
|
||||
dc_receive_imf(
|
||||
&t,
|
||||
include_bytes!("../test-data/message/mailinglist_with_mimepart_footer.eml"),
|
||||
"INBOX",
|
||||
1,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let msg = t.get_last_msg().await;
|
||||
assert_eq!(
|
||||
msg.text,
|
||||
Some("[Intern] important stuff – Hi mr ... [text part]".to_string())
|
||||
);
|
||||
assert!(msg.has_html());
|
||||
let chat = Chat::load_from_db(&t, msg.chat_id).await.unwrap();
|
||||
assert_eq!(get_chat_msgs(&t, deaddrop, 0, None).await.len(), 1);
|
||||
assert_eq!(get_chat_msgs(&t, msg.chat_id, 0, None).await.len(), 1);
|
||||
assert_eq!(chat.typ, Chattype::Mailinglist);
|
||||
assert_eq!(chat.blocked, Blocked::Deaddrop);
|
||||
assert_eq!(chat.grpid, "intern.lists.abc.de");
|
||||
assert_eq!(chat.name, "Intern");
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
async fn test_dont_show_tokens_in_contacts_list() {
|
||||
check_dont_show_in_contacts_list(
|
||||
|
||||
69
test-data/message/mailinglist_with_mimepart_footer.eml
Normal file
69
test-data/message/mailinglist_with_mimepart_footer.eml
Normal file
@@ -0,0 +1,69 @@
|
||||
Return-Path: <intern-bounces@lists.abc.de>
|
||||
X-Original-To: bp@def.com
|
||||
Delivered-To: m1234567@dd12345.abcserver.com
|
||||
X-policyd-weight: using cached result; rate:hard: -6.1
|
||||
Received: from mail.alfi.li (mail.alfi.li [85.14.254.25])
|
||||
by dd12345.abcserver.com (Postfix) with ESMTPS id AF73653C05E0
|
||||
for <bp@def.com>; Sat, 20 Feb 2021 22:04:26 +0100 (CET)
|
||||
To: intern@lists.abc.de
|
||||
References: <1234565f-e80e-7b88-7b99-3962b40b53dd@mr.de>
|
||||
From: s l <s@sl.de>
|
||||
Message-ID: <7753a9a4-b8fe-03a5-81cd-687b05596640@sl.de>
|
||||
Date: Sat, 20 Feb 2021 22:05:57 +0100
|
||||
In-Reply-To: <1234565f-e80e-7b88-7b99-3962b40b53dd@mr.de>
|
||||
Content-Language: de-DE
|
||||
X-MBO-SPAM-Probability:
|
||||
X-Rspamd-Score: -3.77 / 15.00 / 15.00
|
||||
X-Rspamd-UID: 01315b
|
||||
Subject: [Intern] important stuff
|
||||
X-BeenThere: intern@lists.abc.de
|
||||
X-Mailman-Version: 2.1.29
|
||||
Precedence: list
|
||||
List-Id: <intern.lists.abc.de>
|
||||
List-Unsubscribe: <http://lists.abc.de/mailman/options/intern>,
|
||||
<mailto:intern-request@lists.abc.de?subject=unsubscribe>
|
||||
List-Archive: <http://lists.abc.de/mailman/private/intern/>
|
||||
List-Post: <mailto:intern@lists.abc.de>
|
||||
List-Help: <mailto:intern-request@lists.abc.de?subject=help>
|
||||
List-Subscribe: <http://lists.abc.de/mailman/listinfo/intern>,
|
||||
<mailto:intern-request@lists.abc.de?subject=subscribe>
|
||||
Content-Type: multipart/mixed; boundary="===============4579664526791456147=="
|
||||
Errors-To: intern-bounces@lists.abc.de
|
||||
Sender: "Intern" <intern-bounces@lists.abc.de>
|
||||
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--===============4579664526791456147==
|
||||
Content-Type: multipart/alternative;
|
||||
boundary="------------D54E6E735C08D54533EF8F41"
|
||||
Content-Language: de-DE
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--------------D54E6E735C08D54533EF8F41
|
||||
Content-Type: text/plain; charset=utf-8; format=flowed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Hi mr ... [text part]
|
||||
|
||||
--------------D54E6E735C08D54533EF8F41
|
||||
Content-Type: text/html; charset=utf-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
<html>Hi mr ... [html part]</html>
|
||||
|
||||
--------------D54E6E735C08D54533EF8F41--
|
||||
|
||||
--===============4579664526791456147==
|
||||
Content-Type: text/plain; charset="us-ascii"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Content-Disposition: inline
|
||||
|
||||
_______________________________________________
|
||||
Intern mailing list
|
||||
Intern@lists.abc.de
|
||||
http://lists.abc.de/mailman/listinfo/intern
|
||||
[this footer is a separate text/plain part,
|
||||
added by some ml software if the editable text is html]
|
||||
|
||||
--===============4579664526791456147==--
|
||||
|
||||
Reference in New Issue
Block a user