Simplify saving original chat ID

This commit is contained in:
link2xt
2022-10-18 19:15:35 +00:00
parent 2e946a008f
commit 5cf364b55b

View File

@@ -847,22 +847,15 @@ async fn add_parts(
} }
} }
if is_mdn { let orig_chat_id = chat_id;
chat_id = Some(DC_CHAT_ID_TRASH); let chat_id = if is_mdn || is_reaction {
} 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 { } else {
None chat_id.unwrap_or_else(|| {
};
let chat_id = chat_id.unwrap_or_else(|| {
info!(context, "No chat id for message (TRASH)"); info!(context, "No chat id for message (TRASH)");
DC_CHAT_ID_TRASH DC_CHAT_ID_TRASH
}); })
};
// Extract ephemeral timer from the message or use the existing timer if the message is not fully downloaded. // 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() { let mut ephemeral_timer = if is_partial_download.is_some() {
@@ -1071,7 +1064,7 @@ async fn add_parts(
set_msg_reaction( set_msg_reaction(
context, context,
&mime_in_reply_to, &mime_in_reply_to,
orig_reaction_chat_id.unwrap_or_default(), orig_chat_id.unwrap_or_default(),
from_id, from_id,
Reaction::from(part.msg.as_str()), Reaction::from(part.msg.as_str()),
) )