Skip to content

Commit c596bfc

Browse files
committed
refactor: add_parts: Remove excessive is_mdn checks
1 parent 379b318 commit c596bfc

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/receive_imf.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,11 @@ async fn add_parts(
778778
}
779779
}
780780

781+
if chat_id.is_none() && is_mdn {
782+
chat_id = Some(DC_CHAT_ID_TRASH);
783+
info!(context, "Message is an MDN (TRASH).",);
784+
}
785+
781786
if mime_parser.incoming {
782787
to_id = ContactId::SELF;
783788

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

792-
if chat_id.is_none() && is_mdn {
793-
chat_id = Some(DC_CHAT_ID_TRASH);
794-
info!(context, "Message is an MDN (TRASH).",);
795-
}
796-
797797
let create_blocked_default = if is_bot {
798798
Blocked::Not
799799
} else {
@@ -977,7 +977,6 @@ async fn add_parts(
977977
// the 1:1 chat accordingly.
978978
let chat = match is_partial_download.is_none()
979979
&& mime_parser.get_header(HeaderDef::SecureJoin).is_none()
980-
&& !is_mdn
981980
{
982981
true => Some(Chat::load_from_db(context, chat_id).await?)
983982
.filter(|chat| chat.typ == Chattype::Single),
@@ -1236,7 +1235,7 @@ async fn add_parts(
12361235
}
12371236

12381237
let orig_chat_id = chat_id;
1239-
let mut chat_id = if is_mdn || is_reaction {
1238+
let mut chat_id = if is_reaction {
12401239
DC_CHAT_ID_TRASH
12411240
} else {
12421241
chat_id.unwrap_or_else(|| {
@@ -1694,7 +1693,7 @@ RETURNING id
16941693
"Message has {icnt} parts and is assigned to chat #{chat_id}."
16951694
);
16961695

1697-
if !is_mdn {
1696+
if !chat_id.is_trash() {
16981697
let mut chat = Chat::load_from_db(context, chat_id).await?;
16991698

17001699
// In contrast to most other update-timestamps,

0 commit comments

Comments
 (0)