From c7340e04ec1986851cbacf9be8dd868574b3606a Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 10 Aug 2025 07:58:49 +0000 Subject: [PATCH] feat: do not require resent messages to be from the same chat Chat was only loaded to avoid removing GuaranteeE2ee for protected chats, but resending a message in protected chat is guaranteed to be encrypted anyway. --- src/chat.rs | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 192ac94d9..d71746074 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -4542,18 +4542,9 @@ pub(crate) async fn save_copy_in_self_talk( /// /// This is primarily intended to make existing webxdcs available to new chat members. pub async fn resend_msgs(context: &Context, msg_ids: &[MsgId]) -> Result<()> { - let mut chat_id = None; let mut msgs: Vec = Vec::new(); for msg_id in msg_ids { let msg = Message::load_from_db(context, *msg_id).await?; - if let Some(chat_id) = chat_id { - ensure!( - chat_id == msg.chat_id, - "messages to resend needs to be in the same chat" - ); - } else { - chat_id = Some(msg.chat_id); - } ensure!( msg.from_id == ContactId::SELF, "can resend only own messages" @@ -4562,22 +4553,7 @@ pub async fn resend_msgs(context: &Context, msg_ids: &[MsgId]) -> Result<()> { msgs.push(msg) } - let Some(chat_id) = chat_id else { - return Ok(()); - }; - - let chat = Chat::load_from_db(context, chat_id).await?; for mut msg in msgs { - if msg.get_showpadlock() && !chat.is_protected() { - msg.param.remove(Param::GuaranteeE2ee); - - // Do not call `msg.update_param` here. - // We do not want the message to appear unencrypted - // if it is loaded precisely at this time. - // - // Actual encryption status is persisted - // by `create_send_msg_jobs` below. - } match msg.get_state() { // `get_state()` may return an outdated `OutPending`, so update anyway. MessageState::OutPending