[geary: 11/13] Use similar logic to InsertOperation to know whether or not an unflagged message is from outside the



commit ebd66504aa55235ffe1b2e6c8b9ba0435f41448f
Author: James Magahern <james magahern com>
Date:   Fri Jan 25 01:54:27 2019 -0800

    Use similar logic to InsertOperation to know whether or not an unflagged message is from outside the 
monitor window

 src/engine/app/app-conversation-monitor.vala | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/engine/app/app-conversation-monitor.vala b/src/engine/app/app-conversation-monitor.vala
index 21529388..510ccfa0 100644
--- a/src/engine/app/app-conversation-monitor.vala
+++ b/src/engine/app/app-conversation-monitor.vala
@@ -857,8 +857,17 @@ public class Geary.App.ConversationMonitor : BaseObject {
             Conversation? conversation = this.conversations.get_by_email_identifier(id);
             if (conversation == null) {
                 if (folder == this.base_folder) {
-                    debug("Unflagging email %s for deletion resurrects conversation", id.to_string());
-                    inserted_ids.add(id);
+                    // Check to see if the incoming message is sorted later than the last message in the
+                    // window. If it is, don't resurrect it since it likely hasn't been loaded yet.
+                    Geary.EmailIdentifier? lowest = this.window_lowest;
+                    if (lowest != null) {
+                        if (lowest.natural_sort_comparator(id) < 0) {
+                            debug("Unflagging email %s for deletion resurrects conversation", 
id.to_string());
+                            inserted_ids.add(id);
+                        } else {
+                            debug("Not resurrecting undeleted email %s outside of window", id.to_string());
+                        }
+                    }
                 }
 
                 continue;


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