commit f290305650dfda11a458fb62c5b99105402743c0
parent df72056384694a05f0400dbd073e871d7b483f5b
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date: Wed, 9 Jun 2010 19:09:25 -0700
more workarounds for empty thread bug
Diffstat:
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
@@ -231,7 +231,7 @@ EOS
old_cursor_thread = cursor_thread
@mutex.synchronize do
## let's see you do THIS in python
- @threads = @ts.threads.select { |t| !@hidden_threads.member?(t) }.sort_by(&:sort_key)
+ @threads = @ts.threads.select { |t| !@hidden_threads.member?(t) }.select(&:has_message?).sort_by(&:sort_key)
@size_widgets = @threads.map { |t| size_widget_for_thread t }
@size_widget_width = @size_widgets.max_of { |w| w.display_length }
@date_widgets = @threads.map { |t| date_widget_for_thread t }
diff --git a/lib/sup/thread.rb b/lib/sup/thread.rb
@@ -85,6 +85,7 @@ class Thread
end
def first; each { |m, *o| return m if m }; nil; end
+ def has_message?; any? { |m, *o| m.is_a? Message }; end
def dirty?; any? { |m, *o| m && m.dirty? }; end
def date; map { |m, *o| m.date if m }.compact.max; end
def snippet