Skip to content

Commit 51b2395

Browse files
committed
feat: Use spaced em dash to separate message Subject from text
Using spaced en dash for this is typographically incorrect in some languages (e.g. in Russian). Also using spaced en dash looks like adding a break in a sentence for many languages, this may be confusing, particularly if the message text itself contains such breaks. We're actually joining two different texts, so it's better to make a break between them stronger.
1 parent 9bc2aee commit 51b2395

File tree

6 files changed

+39
-39
lines changed

6 files changed

+39
-39
lines changed

python/tests/test_1_online.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ def test_dont_show_emails(acfactory, lp):
968968
msg = fresh_msgs[0]
969969
chat_msgs = msg.chat.get_messages()
970970
assert len(chat_msgs) == 1
971-
assert any(msg.text == "subj Actually interesting message in Spam" for msg in chat_msgs)
971+
assert any(msg.text == "subj Actually interesting message in Spam" for msg in chat_msgs)
972972

973973
assert not any("unknown.address" in c.get_name() for c in ac1.get_chats())
974974
ac1.direct_imap.select_folder("Spam")
@@ -983,7 +983,7 @@ def test_dont_show_emails(acfactory, lp):
983983
ac1.start_io()
984984
msg2 = ac1._evtracker.wait_next_messages_changed()
985985

986-
assert msg2.text == "subj message in Drafts received later"
986+
assert msg2.text == "subj message in Drafts received later"
987987
assert len(msg.chat.get_messages()) == 2
988988

989989

src/decrypt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ mod tests {
179179
receive_imf(&bob, attachment_mime, false).await?;
180180
let msg = bob.get_last_msg().await;
181181
// Subject should be prepended because the attachment doesn't have "Chat-Version".
182-
assert_eq!(msg.text, "Hello, Bob! Hello from Thunderbird!");
182+
assert_eq!(msg.text, "Hello, Bob! Hello from Thunderbird!");
183183

184184
Ok(())
185185
}

src/mimeparser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ impl MimeMessage {
854854
.iter_mut()
855855
.find(|part| !part.msg.is_empty() && !part.is_reaction);
856856
if let Some(part) = part_with_text {
857-
part.msg = format!("{} {}", subject, part.msg);
857+
part.msg = format!("{} {}", subject, part.msg);
858858
}
859859
}
860860
}

src/mimeparser/mimeparser_tests.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ MDYyMDYxNTE1RTlDOEE4Cj4+CnN0YXJ0eHJlZgo4Mjc4CiUlRU9GCg==
763763

764764
assert_eq!(message.parts.len(), 1);
765765
assert_eq!(message.parts[0].typ, Viewtype::File);
766-
assert_eq!(message.parts[0].msg, "Mail with inline attachment Hello!");
766+
assert_eq!(message.parts[0].msg, "Mail with inline attachment Hello!");
767767
}
768768

769769
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
@@ -846,7 +846,7 @@ iVBORw0KGgoAAAANSUhEUgAAACAAAAAeCAAAAABoYUP1AAAAAXNSR0IArs4c6QAAAo1JREFUKJFdkdFu
846846

847847
assert_eq!(message.parts.len(), 1);
848848
assert_eq!(message.parts[0].typ, Viewtype::Image);
849-
assert_eq!(message.parts[0].msg, "example Test");
849+
assert_eq!(message.parts[0].msg, "example Test");
850850
}
851851

852852
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
@@ -910,7 +910,7 @@ iVBORw0KGgoAAAANSUhEUgAAACAAAAAeCAAAAABoYUP1AAAAAXNSR0IArs4c6QAAAo1JREFUKJFdkdFu
910910

911911
assert_eq!(message.parts.len(), 1);
912912
assert_eq!(message.parts[0].typ, Viewtype::Image);
913-
assert_eq!(message.parts[0].msg, "Test subject Test");
913+
assert_eq!(message.parts[0].msg, "Test subject Test");
914914
}
915915

916916
// Outlook specifies filename in the "name" attribute of Content-Type
@@ -976,7 +976,7 @@ iVBORw0KGgoAAAANSUhEUgAAACAAAAAeCAAAAABoYUP1AAAAAXNSR0IArs4c6QAAAo1JREFUKJFdkdFu
976976

977977
assert_eq!(message.parts.len(), 1);
978978
assert_eq!(message.parts[0].typ, Viewtype::Image);
979-
assert_eq!(message.parts[0].msg, "Delta Chat is great stuff! Test");
979+
assert_eq!(message.parts[0].msg, "Delta Chat is great stuff! Test");
980980
}
981981

982982
#[test]
@@ -1199,7 +1199,7 @@ async fn test_add_subj_to_multimedia_msg() {
11991199
let msg_id = chats.get_msg_id(0).unwrap().unwrap();
12001200
let msg = Message::load_from_db(&t.ctx, msg_id).await.unwrap();
12011201

1202-
assert_eq!(msg.text, "subj with important info body text");
1202+
assert_eq!(msg.text, "subj with important info body text");
12031203
assert_eq!(msg.viewtype, Viewtype::Image);
12041204
assert_eq!(msg.error(), None);
12051205
assert_eq!(msg.is_dc_message, MessengerMessage::No);
@@ -1233,7 +1233,7 @@ async fn test_mime_modified_alt_plain_html() {
12331233
assert!(mimeparser.is_mime_modified);
12341234
assert_eq!(
12351235
mimeparser.parts[0].msg,
1236-
"mime-modified test this is plain"
1236+
"mime-modified test this is plain"
12371237
);
12381238
}
12391239

@@ -1245,7 +1245,7 @@ async fn test_mime_modified_alt_plain() {
12451245
assert!(!mimeparser.is_mime_modified);
12461246
assert_eq!(
12471247
mimeparser.parts[0].msg,
1248-
"mime-modified test \
1248+
"mime-modified test \
12491249
mime-modified should not be set set as there is no html and no special stuff;\n\
12501250
although not being a delta-message.\n\
12511251
test some special html-characters as < > and & but also \" and ' :)"
@@ -1260,7 +1260,7 @@ async fn test_mime_modified_alt_html() {
12601260
assert!(mimeparser.is_mime_modified);
12611261
assert_eq!(
12621262
mimeparser.parts[0].msg,
1263-
"mime-modified test mime-modified *set*; simplify is always regarded as lossy."
1263+
"mime-modified test mime-modified *set*; simplify is always regarded as lossy."
12641264
);
12651265
}
12661266

@@ -1272,7 +1272,7 @@ async fn test_mime_modified_html() {
12721272
assert!(mimeparser.is_mime_modified);
12731273
assert_eq!(
12741274
mimeparser.parts[0].msg,
1275-
"mime-modified test mime-modified *set*; simplify is always regarded as lossy."
1275+
"mime-modified test mime-modified *set*; simplify is always regarded as lossy."
12761276
);
12771277
}
12781278

@@ -1614,7 +1614,7 @@ async fn test_receive_eml() -> Result<()> {
16141614
);
16151615
assert_eq!(
16161616
mime_message.parts[0].msg,
1617-
"this is a classic email I attached the .EML file".to_string()
1617+
"this is a classic email I attached the .EML file".to_string()
16181618
);
16191619
assert_eq!(
16201620
mime_message.parts[0].param.get(Param::Filename),
@@ -1713,7 +1713,7 @@ async fn test_tlsrpt() -> Result<()> {
17131713
assert_eq!(msg.parts[0].typ, Viewtype::File);
17141714
assert_eq!(
17151715
msg.parts[0].msg,
1716-
"Report Domain: nine.testrun.org Submitter: google.com Report-ID: <[email protected]> This is an aggregate TLS report from google.com"
1716+
"Report Domain: nine.testrun.org Submitter: google.com Report-ID: <[email protected]> This is an aggregate TLS report from google.com"
17171717
);
17181718

17191719
Ok(())
@@ -1774,7 +1774,7 @@ Content-Type: text/plain; charset=utf-8
17741774

17751775
assert_eq!(message.parts.len(), 1);
17761776
assert_eq!(message.parts[0].typ, Viewtype::Text);
1777-
// Not "Some subject /help"
1777+
// Not "Some subject /help"
17781778
assert_eq!(message.parts[0].msg, "/help");
17791779
}
17801780

0 commit comments

Comments
 (0)