浏览代码

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 {