]> git.cworth.org Git - sup/commitdiff
make snippets come from the latest reply instead of the earliest (thanks to Phil...
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 27 Oct 2007 22:19:07 +0000 (22:19 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 27 Oct 2007 22:19:07 +0000 (22:19 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@628 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/thread.rb

index a0cf35dea9bba2aa61699ac16b23f2ed31e113b0..230fe1066376ad1953c23ae8304f846c4fe445e1 100644 (file)
@@ -54,7 +54,7 @@ class Thread
 
   ## yields each message, its depth, and its parent. the message yield
   ## parameter can be a Message object, or :fake_root, or nil (no
-  ## message found but the presence of one induced from other
+  ## message found but the presence of one deduced from other
   ## messages).
   def each fake_root=false
     adj = 0
@@ -85,7 +85,7 @@ class Thread
   def first; each { |m, *o| return m if m }; nil; end
   def dirty?; any? { |m, *o| m && m.dirty? }; end
   def date; map { |m, *o| m.date if m }.compact.max; end
-  def snippet; argfind { |m, *o| m && m.snippet }; end
+  def snippet; sort_by { |m, d, p| -d }.argfind { |m, d, p| m && !m.snippet.empty? && m.snippet } || "" end
   def authors; map { |m, *o| m.from if m }.compact.uniq; end
 
   def apply_label t; each { |m, *o| m && m.add_label(t) }; end