From 5cf364b55b09619d3c29423ea08c05850b46b692 Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 18 Oct 2022 19:15:35 +0000 Subject: [PATCH] Simplify saving original chat ID --- src/receive_imf.rs | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 803a9af9c..dec2be59a 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -847,22 +847,15 @@ async fn add_parts( } } - if is_mdn { - chat_id = Some(DC_CHAT_ID_TRASH); - } - - let orig_reaction_chat_id = if is_reaction { - let orig_reaction_chat_id = chat_id; - chat_id = Some(DC_CHAT_ID_TRASH); - orig_reaction_chat_id - } else { - None - }; - - let chat_id = chat_id.unwrap_or_else(|| { - info!(context, "No chat id for message (TRASH)"); + let orig_chat_id = chat_id; + let chat_id = if is_mdn || is_reaction { DC_CHAT_ID_TRASH - }); + } else { + chat_id.unwrap_or_else(|| { + info!(context, "No chat id for message (TRASH)"); + DC_CHAT_ID_TRASH + }) + }; // Extract ephemeral timer from the message or use the existing timer if the message is not fully downloaded. let mut ephemeral_timer = if is_partial_download.is_some() { @@ -1071,7 +1064,7 @@ async fn add_parts( set_msg_reaction( context, &mime_in_reply_to, - orig_reaction_chat_id.unwrap_or_default(), + orig_chat_id.unwrap_or_default(), from_id, Reaction::from(part.msg.as_str()), )