diff --git a/src/imap.rs b/src/imap.rs index df4ed807e..d7fcf1397 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -728,8 +728,6 @@ impl Imap { }; let read_cnt = msgs.len(); - let show_emails = ShowEmails::from_i32(context.get_config_int(Config::ShowEmails).await?) - .unwrap_or_default(); let download_limit = context.download_limit().await?; let mut uids_fetch = Vec::<(_, bool /* partially? */)>::with_capacity(msgs.len() + 1); let mut uid_message_ids = BTreeMap::new(); @@ -778,7 +776,6 @@ impl Imap { &headers, &message_id, fetch_response.flags(), - show_emails, ) .await.context("prefetch_should_download")? { @@ -2055,7 +2052,6 @@ pub(crate) async fn prefetch_should_download( headers: &[mailparse::MailHeader<'_>], message_id: &str, mut flags: impl Iterator>, - show_emails: ShowEmails, ) -> Result { if message::rfc724_mid_exists(context, message_id) .await? @@ -2115,6 +2111,9 @@ pub(crate) async fn prefetch_should_download( }) .unwrap_or_default(); + let show_emails = + ShowEmails::from_i32(context.get_config_int(Config::ShowEmails).await?).unwrap_or_default(); + let show = is_autocrypt_setup_message || match show_emails { ShowEmails::Off => is_chat_message || is_reply_to_chat_message, diff --git a/src/receive_imf/tests.rs b/src/receive_imf/tests.rs index b2564fc75..50aa285ce 100644 --- a/src/receive_imf/tests.rs +++ b/src/receive_imf/tests.rs @@ -5,7 +5,7 @@ use crate::aheader::EncryptPreference; use crate::chat::get_chat_contacts; use crate::chat::{get_chat_msgs, ChatItem, ChatVisibility}; use crate::chatlist::Chatlist; -use crate::constants::{ShowEmails, DC_GCL_NO_SPECIALS}; +use crate::constants::DC_GCL_NO_SPECIALS; use crate::imap::prefetch_should_download; use crate::message::Message; use crate::test_utils::{get_chat_msg, TestContext, TestContextManager}; @@ -647,15 +647,11 @@ async fn test_parse_ndn( // Check that the ndn would be downloaded: let headers = mailparse::parse_mail(raw_ndn).unwrap().headers; - assert!(prefetch_should_download( - &t, - &headers, - "some-other-message-id", - std::iter::empty(), - ShowEmails::Off, - ) - .await - .unwrap()); + assert!( + prefetch_should_download(&t, &headers, "some-other-message-id", std::iter::empty(),) + .await + .unwrap() + ); receive_imf(&t, raw_ndn, false).await.unwrap(); let msg = Message::load_from_db(&t, msg_id).await.unwrap();