From 6d2ac304614272e8356637ec7e9be2d2f85d9e32 Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 29 Sep 2023 14:52:33 +0000 Subject: [PATCH] fix: do not put the status footer into reaction MIME parts --- src/mimefactory.rs | 7 +++++-- src/reaction.rs | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 0f55423cc..d9d6ea1ee 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -1172,7 +1172,10 @@ impl<'a> MimeFactory<'a> { } let flowed_text = format_flowed(final_text); - let footer = &self.selfstatus; + let is_reaction = self.msg.param.get_int(Param::Reaction).unwrap_or_default() != 0; + + let footer = if is_reaction { "" } else { &self.selfstatus }; + let message_text = format!( "{}{}{}{}{}{}", fwdhint.unwrap_or_default(), @@ -1195,7 +1198,7 @@ impl<'a> MimeFactory<'a> { )) .body(message_text); - if self.msg.param.get_int(Param::Reaction).unwrap_or_default() != 0 { + if is_reaction { main_part = main_part.header(("Content-Disposition", "reaction")); } diff --git a/src/reaction.rs b/src/reaction.rs index c349ed312..d8cb4450c 100644 --- a/src/reaction.rs +++ b/src/reaction.rs @@ -464,6 +464,16 @@ Content-Disposition: reaction\n\ let alice = TestContext::new_alice().await; let bob = TestContext::new_bob().await; + // Test that the status does not get mixed up into reactions. + alice + .set_config( + Config::Selfstatus, + Some("Buy Delta Chat today and make this banner go away!"), + ) + .await?; + bob.set_config(Config::Selfstatus, Some("Sent from my Delta Chat Pro. 👍")) + .await?; + let chat_alice = alice.create_chat(&bob).await; let alice_msg = alice.send_text(chat_alice.id, "Hi!").await; let bob_msg = bob.recv_msg(&alice_msg).await;