mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 22:46:29 +03:00
feat: Clear Param::IsEdited when forwarding a message
This commit is contained in:
@@ -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::WebxdcDocumentTimestamp);
|
||||||
msg.param.remove(Param::WebxdcSummary);
|
msg.param.remove(Param::WebxdcSummary);
|
||||||
msg.param.remove(Param::WebxdcSummaryTimestamp);
|
msg.param.remove(Param::WebxdcSummaryTimestamp);
|
||||||
|
msg.param.remove(Param::IsEdited);
|
||||||
msg.in_reply_to = None;
|
msg.in_reply_to = None;
|
||||||
|
|
||||||
// do not leak data as group names; a default subject is generated by mimefactory
|
// do not leak data as group names; a default subject is generated by mimefactory
|
||||||
|
|||||||
@@ -3853,6 +3853,7 @@ async fn test_send_edit_request() -> Result<()> {
|
|||||||
bob.recv_msg_opt(&sent2).await;
|
bob.recv_msg_opt(&sent2).await;
|
||||||
let test = Message::load_from_db(bob, bob_msg.id).await?;
|
let test = Message::load_from_db(bob, bob_msg.id).await?;
|
||||||
assert_eq!(test.text, "Text me on Delta.Chat");
|
assert_eq!(test.text, "Text me on Delta.Chat");
|
||||||
|
assert!(test.is_edited());
|
||||||
|
|
||||||
// alice has another device, and sees the correction also there
|
// alice has another device, and sees the correction also there
|
||||||
let alice2 = tcm.alice().await;
|
let alice2 = tcm.alice().await;
|
||||||
@@ -3862,6 +3863,12 @@ async fn test_send_edit_request() -> Result<()> {
|
|||||||
alice2.recv_msg_opt(&sent2).await;
|
alice2.recv_msg_opt(&sent2).await;
|
||||||
let test = Message::load_from_db(&alice2, alice2_msg.id).await?;
|
let test = Message::load_from_db(&alice2, alice2_msg.id).await?;
|
||||||
assert_eq!(test.text, "Text me on Delta.Chat");
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user