[geary/wip/email-flag-refinement-redux: 5/14] Pass a email id with a position when setting flags during a merge



commit 5c9234f0ce0d201210b277163a54b62e4e5eac1a
Author: Michael Gratton <mike vee net>
Date:   Wed Feb 13 18:46:46 2019 +1100

    Pass a email id with a position when setting flags during a merge
    
    This ensures that flag updates actually happen when doing a merge
    with remote email instances obtained from the IMAP stack.

 src/engine/imap-db/imap-db-folder.vala | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/engine/imap-db/imap-db-folder.vala b/src/engine/imap-db/imap-db-folder.vala
index b459fb74..591fcc00 100644
--- a/src/engine/imap-db/imap-db-folder.vala
+++ b/src/engine/imap-db/imap-db-folder.vala
@@ -2008,12 +2008,20 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics {
                 unread_count_change += email.email_flags.is_unread() ? 1 : -1;
             }
 
-            Gee.Map<ImapDB.EmailIdentifier, Geary.EmailFlags> map =
-               new Gee.HashMap<ImapDB.EmailIdentifier, Geary.EmailFlags>();
-            map.set((ImapDB.EmailIdentifier) email.id, email.email_flags);
-            do_set_email_flags(cx, map, cancellable);
+            // do_set_email_flags requires a valid message location,
+            // but doesn't accept one as an arg, so despite knowing
+            // the location here, make sure we pass an id with a
+            // message_id in so it can look the location back up.
+            do_set_email_flags(
+                cx,
+                Collection.single_map<ImapDB.EmailIdentifier,Geary.EmailFlags>(
+                    (ImapDB.EmailIdentifier) row_email.id, email.email_flags
+                ),
+                cancellable
+            );
 
             post_fields |= Geary.Email.Field.FLAGS;
+
         }
     }
 


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