소스 검색

view: ensure envelope headers are always populated

Some email backends return Envelopes with only the basic headers filled
in. But that might clash with a user's configurations which operates on
specific headers when viewing an email. So, when having loaded an email
completely, make sure its envelope's headers is completely populated
before presenting it to the user.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Manos Pitsidianakis 7 달 전
부모
커밋
fcab855f
1개의 변경된 파일5개의 추가작업 그리고 10개의 파일을 삭제
  1. 5 10
      meli/src/mail/view/state.rs

+ 5 - 10
meli/src/mail/view/state.rs

@@ -96,17 +96,12 @@ impl MailViewState {
             return;
         };
         let account = &mut context.accounts[&coordinates.0];
-        if account
+        // Ensure all envelope headers are populated, because the email backend might
+        // have not populated them all.
+        _ = account
             .collection
-            .get_env(coordinates.2)
-            .other_headers()
-            .is_empty()
-        {
-            let _ = account
-                .collection
-                .get_env_mut(coordinates.2)
-                .populate_headers(&bytes);
-        }
+            .get_env_mut(coordinates.2)
+            .populate_headers(&bytes);
         let env = Box::new(account.collection.get_env(coordinates.2).clone());
         let env_view = Box::new(EnvelopeView::new(
             Mail {