]> git.notmuchmail.org Git - sup/commitdiff
bugfix: make thread-index-mode handle deletion notices correctly
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 30 Dec 2007 04:40:00 +0000 (20:40 -0800)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 30 Dec 2007 05:04:56 +0000 (21:04 -0800)
Originally was calling ThreadSet#remove_mid with the first message of the
thread, which didn't really make sense, eh?

lib/sup/modes/thread-index-mode.rb
lib/sup/thread.rb

index 85fb98607a6c0723a134546a07fb19c450823ee5..67bf05f5b7f9fd8dfbb267b477b5f839d0710a21 100644 (file)
@@ -139,7 +139,7 @@ EOS
   def handle_deleted_update sender, m
     @ts_mutex.synchronize do
       return unless @ts.contains? m
-      @ts.remove_id m.id
+      @ts.remove_thread_containing_id m.id
     end
     update
   end
index 39d4495441150b9cc3229216abc9d65567cbdd01..d41cb515c1328d51cf3aa8393f7d988ec813ff2f 100644 (file)
@@ -320,12 +320,18 @@ class ThreadSet
   end
   private :remove_container
 
-  ## remove a single message id
+  ## remove a single message id. not used anywhere, afaik.
   def remove_id mid
     return unless(c = @messages[mid])
     remove_container c
   end
 
+  def remove_thread_containing_id mid
+    c = @messages[mid] or return
+    t = c.root.thread
+    @threads.delete_if { |key, thread| t == thread }
+  end
+
   ## load in (at most) num number of threads from the index
   def load_n_threads num, opts={}
     @index.each_id_by_date opts do |mid, builder|