From: William Morgan Date: Sun, 30 Dec 2007 04:40:00 +0000 (-0800) Subject: bugfix: make thread-index-mode handle deletion notices correctly X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=7640a4e99da251fb9f0284dd24c854f3795b1786;p=sup bugfix: make thread-index-mode handle deletion notices correctly Originally was calling ThreadSet#remove_mid with the first message of the thread, which didn't really make sense, eh? --- diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index 85fb986..67bf05f 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -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 diff --git a/lib/sup/thread.rb b/lib/sup/thread.rb index 39d4495..d41cb51 100644 --- a/lib/sup/thread.rb +++ b/lib/sup/thread.rb @@ -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|