diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 1c7b564d3..9a5c90b39 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -1872,19 +1872,23 @@ impl MimeFactory { let footer = if is_reaction { "" } else { &self.selfstatus }; - let message_text = format!( - "{}{}{}{}{}{}", - fwdhint.unwrap_or_default(), - quoted_text.unwrap_or_default(), - escape_message_footer_marks(final_text), - if !final_text.is_empty() && !footer.is_empty() { - "\r\n\r\n" - } else { - "" - }, - if !footer.is_empty() { "-- \r\n" } else { "" }, - footer - ); + let message_text = if self.pre_message_mode == PreMessageMode::Post { + "".to_string() + } else { + format!( + "{}{}{}{}{}{}", + fwdhint.unwrap_or_default(), + quoted_text.unwrap_or_default(), + escape_message_footer_marks(final_text), + if !final_text.is_empty() && !footer.is_empty() { + "\r\n\r\n" + } else { + "" + }, + if !footer.is_empty() { "-- \r\n" } else { "" }, + footer + ) + }; let mut main_part = MimePart::new("text/plain", message_text); if is_reaction { diff --git a/src/tests/pre_messages/receiving.rs b/src/tests/pre_messages/receiving.rs index b3ba6a4e5..431f2e426 100644 --- a/src/tests/pre_messages/receiving.rs +++ b/src/tests/pre_messages/receiving.rs @@ -130,7 +130,7 @@ async fn test_out_of_order_receiving() -> Result<()> { } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_msg_text_on_lost_pre_msg() -> Result<()> { +async fn test_lost_pre_msg() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; let bob = &tcm.bob().await; @@ -144,7 +144,7 @@ async fn test_msg_text_on_lost_pre_msg() -> Result<()> { let _pre_msg = alice.pop_sent_msg().await; let msg = bob.recv_msg(&full_msg).await; assert_eq!(msg.download_state, DownloadState::Done); - assert_eq!(msg.text, "populate"); + assert_eq!(msg.text, ""); Ok(()) }