feat: Clear Param::IsEdited when forwarding a message

This commit is contained in:
iequidoo
2025-04-01 05:25:42 -03:00
committed by iequidoo
parent ee079ce021
commit a1837aeb8c
2 changed files with 8 additions and 0 deletions

View File

@@ -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

View File

@@ -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(())
}