Sfoglia il codice sorgente

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 mesi fa
parent
commit
fcab855f
1 ha cambiato i file con 5 aggiunte e 10 eliminazioni
  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 {