sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 81794a14968410f70ee0563afcf3b1e7e90be101
parent 3936930fd1d7d37704b58fbdec42c26c2af2b596
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Thu, 24 Jan 2008 18:48:44 -0800

bugfix: hidden threads don't actually reappear when asked to unhide

In ThreadIndexMode, the logic was a little wrong. @hidden_threads isn't
keyed by Messages but by Threads, and for incoming messages that may
belong to a thread, it's necessary to find the corresponding thread first.

This was resulting in threads that had been archived in inbox-mode not
reappearing when new messages that belonged to them arrived.

Diffstat:
M lib/sup/modes/thread-index-mode.rb | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
@@ -513,14 +513,12 @@ EOS
 protected
 
   def add_or_unhide m
-    if @hidden_threads[m]
-      @hidden_threads.delete m
-      ## now it will re-appear when #update is called
-    else
-      @ts_mutex.synchronize do
-        return unless is_relevant?(m) || @ts.is_relevant?(m)
+    @ts_mutex.synchronize do
+      if (is_relevant?(m) || @ts.is_relevant?(m)) && !@ts.contains?(m)
         @ts.load_thread_for_message m
       end
+
+      @hidden_threads.delete @ts.thread_for(m)
     end
 
     update