[geary/wip/131-sent-mail: 11/15] Ensure folder is refreshed ASAP after creating a new message



commit c49d7090f20a5ee80920fb6602f8665b90c1ffa7
Author: Michael Gratton <mike vee net>
Date:   Thu Aug 8 23:08:56 2019 +1000

    Ensure folder is refreshed ASAP after creating a new message
    
    If the server supports UID plus, update the message after it was
    created to get its IMAP fields and anything else missing filled in.
    If not, schedule a explicit folder sync.

 src/engine/imap-engine/imap-engine-minimal-folder.vala | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala 
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 80d4695f..1347c7d4 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -1472,7 +1472,19 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
         if (cancellable != null && cancellable.is_cancelled() && ret != null && remove_folder != null)
             yield remove_folder.remove_email_async(iterate<EmailIdentifier>(ret).to_array_list());
 
-        this._account.update_folder(this);
+        if (ret != null) {
+            // Server returned a UID for the new message. It was saved
+            // locally possibly before the server notified that the
+            // message exists. As such, fetch any missing parts from
+            // the remote to ensure it is properly filled in.
+            yield list_email_by_id_async(
+                ret, 1, ALL, INCLUDING_ID, cancellable
+            );
+        } else {
+            // The server didn't return a UID for the new email, so do
+            // a sync now to ensure it shows up immediately.
+            yield synchronise_remote(cancellable);
+        }
 
         return ret;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]