From 7640a4e99da251fb9f0284dd24c854f3795b1786 Mon Sep 17 00:00:00 2001 From: William Morgan Date: Sat, 29 Dec 2007 20:40:00 -0800 Subject: [PATCH] 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? --- lib/sup/modes/thread-index-mode.rb | 2 +- lib/sup/thread.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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| -- 2.45.2