X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fsup%2Fthread.rb;h=99f21dc31a07bfcb3424a1fc206e20133e2ec8ab;hb=96f349aabe931e097108333858185eb9b639f077;hp=09fbfbbab81d5f6d6814a3e96e166e73370b4bd3;hpb=44aaf4c9e353c5334c8426f36c79cfc2ff8727ba;p=sup diff --git a/lib/sup/thread.rb b/lib/sup/thread.rb index 09fbfbb..99f21dc 100644 --- a/lib/sup/thread.rb +++ b/lib/sup/thread.rb @@ -259,7 +259,7 @@ class ThreadSet @thread_by_subj = thread_by_subj end - def thread_for_id mid; (c = @messages[mid]) && c.root.thread end + def thread_for_id mid; @messages.member?(mid) && @messages[mid].root.thread end def contains_id? id; @messages.member?(id) && !@messages[id].empty? end def thread_for m; thread_for_id m.id end def contains? m; contains_id? m.id end @@ -415,14 +415,8 @@ class ThreadSet ## that we first added a child message with a different ## subject) if root.thread - unless @threads[key] == root.thread - if @threads[key] - root.thread.empty! - @threads[key] << root - root.thread = @threads[key] - else - @threads[key] = root.thread - end + if @threads.member?(key) && @threads[key] != root.thread + @threads.delete key end else thread = @threads[key]