mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 18:36:30 +03:00
Do not prepend subject to mailing list chat messages (#3253)
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
- do not emit notifications for blocked chats #3557
|
||||
- Show attached .eml files correctly #3561
|
||||
- Auto accept contact requests if `Config::Bot` is set for a client #3567
|
||||
- Don't prepend the subject to chat messages in mailinglists
|
||||
|
||||
|
||||
## 1.93.0
|
||||
|
||||
|
||||
@@ -551,7 +551,7 @@ impl MimeMessage {
|
||||
|
||||
// For mailing lists, always add the subject because sometimes there are different topics
|
||||
// and otherwise it might be hard to keep track:
|
||||
if self.is_mailinglist_message() {
|
||||
if self.is_mailinglist_message() && !self.has_chat_version() {
|
||||
prepend_subject = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3572,6 +3572,27 @@ Hello mailinglist!\r\n"
|
||||
)
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn test_mailing_list_chat_message() {
|
||||
let t = TestContext::new_alice().await;
|
||||
|
||||
receive_imf(
|
||||
&t,
|
||||
include_bytes!("../test-data/message/mailinglist_chat_message.eml"),
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let msg = t.get_last_msg().await;
|
||||
assert_eq!(msg.text, Some("hello, this is a test 👋\n\n_______________________________________________\nTest1 mailing list -- test1@example.net\nTo unsubscribe send an email to test1-leave@example.net".to_string()));
|
||||
assert!(!msg.has_html());
|
||||
let chat = Chat::load_from_db(&t, msg.chat_id).await.unwrap();
|
||||
assert_eq!(chat.typ, Chattype::Mailinglist);
|
||||
assert_eq!(chat.blocked, Blocked::Request);
|
||||
assert_eq!(chat.grpid, "test1.example.net");
|
||||
assert_eq!(chat.name, "Test1");
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn test_dont_show_tokens_in_contacts_list() {
|
||||
check_dont_show_in_contacts_list(
|
||||
|
||||
29
test-data/message/mailinglist_chat_message.eml
Normal file
29
test-data/message/mailinglist_chat_message.eml
Normal file
@@ -0,0 +1,29 @@
|
||||
From: <tmp.jvg4y@testrun.org>
|
||||
To: <test1@example.net>
|
||||
Date: Sat, 23 Apr 2022 00:40:47 +0000
|
||||
Message-ID: <Mr.rcN94EGkUqw.mz9DVEAlh1p@testrun.org>
|
||||
In-Reply-To: <Mr.olg8zDlL3HE.rImDv3GWJBk@testrun.org>
|
||||
References: <Mr.a3MAke9MKLq.NNRzMZnyTr6@example.org>
|
||||
<Mr.olg8zDlL3HE.rImDv3GWJBk@testrun.org>
|
||||
Chat-Version: 1.0
|
||||
MIME-Version: 1.0
|
||||
Message-ID-Hash: NTNAY2662T7LMIXRSA2VZMFR52VKP35F
|
||||
X-Message-ID-Hash: NTNAY2662T7LMIXRSA2VZMFR52VKP35F
|
||||
X-MailFrom: tmp.jvg4y@testrun.org
|
||||
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
|
||||
X-Mailman-Version: 3.3.6b1
|
||||
Precedence: list
|
||||
Subject: [Test1] Re: Message from alice@example.org
|
||||
List-Id: <test1.example.net>
|
||||
List-Help: <mailto:test1-request@example.net?subject=help>
|
||||
List-Owner: <mailto:test1-owner@example.net>
|
||||
List-Post: <mailto:test1@example.net>
|
||||
List-Subscribe: <mailto:test1-join@example.net>
|
||||
List-Unsubscribe: <mailto:test1-leave@example.net>
|
||||
Content-Type: text/plain; charset="utf-8"; format="flowed"; delsp="no"
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
aGVsbG8sIHRoaXMgaXMgYSB0ZXN0IPCfkYsNCg0KX19fX19fX19fX19fX19fX19fX19fX19fX19f
|
||||
X19fX19fX19fX19fX19fX19fX18KVGVzdDEgbWFpbGluZyBsaXN0IC0tIHRlc3QxQGV4YW1wbGUu
|
||||
bmV0ClRvIHVuc3Vic2NyaWJlIHNlbmQgYW4gZW1haWwgdG8gdGVzdDEtbGVhdmVAZXhhbXBsZS5u
|
||||
ZXQK
|
||||
Reference in New Issue
Block a user