]> git.notmuchmail.org Git - sup/commitdiff
bugfix: killing threads actually works now
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Tue, 11 Sep 2007 22:21:51 +0000 (22:21 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Tue, 11 Sep 2007 22:21:51 +0000 (22:21 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@562 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/index.rb
lib/sup/thread.rb

index afc98faa3451741265bcd218185669172167e661..f35b7f3beac676a7a75e402602f399501308d784 100644 (file)
@@ -265,9 +265,13 @@ EOS
       q = build_query :qobj => q, :load_killed => true
 
       num_queries += 1
+      killed = false
       @index.search_each(q, :limit => :all) do |docid, score|
         break if opts[:limit] && messages.size >= opts[:limit]
-        break if @index[docid][:label].split(/\s+/).include? "killed" unless opts[:load_killed]
+        if @index[docid][:label].split(/\s+/).include?("killed") && !opts[:load_killed]
+          killed = true
+          break
+        end
         mid = @index[docid][:message_id]
         unless messages.member?(mid)
           #Redwood::log "got #{mid} as a child of #{id}"
@@ -277,8 +281,12 @@ EOS
         end
       end
     end
-    Redwood::log "ran #{num_queries} queries to build thread of #{messages.size + 1} messages for #{m.id}: #{m.subj}" if num_queries > 0
-    messages.each { |mid, builder| yield mid, builder }
+    if killed
+      Redwood::log "thread for #{m.id} is killed, ignoring"
+    else
+      Redwood::log "ran #{num_queries} queries to build thread of #{messages.size + 1} messages for #{m.id}: #{m.subj}" if num_queries > 0
+      messages.each { |mid, builder| yield mid, builder }
+    end
   end
 
   ## builds a message object from a ferret result
index 020cf7256b4d7ebec4e2723a476f3d7961bd6181..c9657c45ecb3d312d6daaeea40d9a8334cf57ba0 100644 (file)
@@ -303,7 +303,6 @@ class ThreadSet
       next if contains_id? mid
 
       m = builder.call
-      add_message m
       load_thread_for_message m, :load_killed => opts[:load_killed]
       yield size if block_given?
     end