Skip to content

Commit

Permalink
refactor: add_parts: Remove excessive is_mdn checks
Browse files Browse the repository at this point in the history
  • Loading branch information
iequidoo committed Jan 3, 2025
1 parent 379b318 commit c596bfc
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/receive_imf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,11 @@ async fn add_parts(
}
}

if chat_id.is_none() && is_mdn {
chat_id = Some(DC_CHAT_ID_TRASH);
info!(context, "Message is an MDN (TRASH).",);
}

if mime_parser.incoming {
to_id = ContactId::SELF;

Expand All @@ -789,11 +794,6 @@ async fn add_parts(
markseen_on_imap_table(context, rfc724_mid).await.ok();
}

if chat_id.is_none() && is_mdn {
chat_id = Some(DC_CHAT_ID_TRASH);
info!(context, "Message is an MDN (TRASH).",);
}

let create_blocked_default = if is_bot {
Blocked::Not
} else {
Expand Down Expand Up @@ -977,7 +977,6 @@ async fn add_parts(
// the 1:1 chat accordingly.
let chat = match is_partial_download.is_none()
&& mime_parser.get_header(HeaderDef::SecureJoin).is_none()
&& !is_mdn
{
true => Some(Chat::load_from_db(context, chat_id).await?)
.filter(|chat| chat.typ == Chattype::Single),
Expand Down Expand Up @@ -1236,7 +1235,7 @@ async fn add_parts(
}

let orig_chat_id = chat_id;
let mut chat_id = if is_mdn || is_reaction {
let mut chat_id = if is_reaction {
DC_CHAT_ID_TRASH
} else {
chat_id.unwrap_or_else(|| {
Expand Down Expand Up @@ -1694,7 +1693,7 @@ RETURNING id
"Message has {icnt} parts and is assigned to chat #{chat_id}."
);

if !is_mdn {
if !chat_id.is_trash() {
let mut chat = Chat::load_from_db(context, chat_id).await?;

// In contrast to most other update-timestamps,
Expand Down

0 comments on commit c596bfc

Please sign in to comment.