From a1837aeb8c73a07fa5ee35d8a1cd265b5a2ff599 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Tue, 1 Apr 2025 05:25:42 -0300 Subject: [PATCH] feat: Clear Param::IsEdited when forwarding a message --- src/chat.rs | 1 + src/chat/chat_tests.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/chat.rs b/src/chat.rs index a102e50dd..b8854b320 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -4378,6 +4378,7 @@ pub async fn forward_msgs(context: &Context, msg_ids: &[MsgId], chat_id: ChatId) msg.param.remove(Param::WebxdcDocumentTimestamp); msg.param.remove(Param::WebxdcSummary); msg.param.remove(Param::WebxdcSummaryTimestamp); + msg.param.remove(Param::IsEdited); msg.in_reply_to = None; // do not leak data as group names; a default subject is generated by mimefactory diff --git a/src/chat/chat_tests.rs b/src/chat/chat_tests.rs index 2fae760d5..0a2ab36e9 100644 --- a/src/chat/chat_tests.rs +++ b/src/chat/chat_tests.rs @@ -3853,6 +3853,7 @@ async fn test_send_edit_request() -> Result<()> { bob.recv_msg_opt(&sent2).await; let test = Message::load_from_db(bob, bob_msg.id).await?; assert_eq!(test.text, "Text me on Delta.Chat"); + assert!(test.is_edited()); // alice has another device, and sees the correction also there let alice2 = tcm.alice().await; @@ -3862,6 +3863,12 @@ async fn test_send_edit_request() -> Result<()> { alice2.recv_msg_opt(&sent2).await; let test = Message::load_from_db(&alice2, alice2_msg.id).await?; assert_eq!(test.text, "Text me on Delta.Chat"); + assert!(test.is_edited()); + + // Alice forwards the edited message, the new message shouldn't have the "edited" mark. + forward_msgs(&alice2, &[test.id], test.chat_id).await?; + let forwarded = alice2.get_last_msg().await; + assert!(!forwarded.is_edited()); Ok(()) }