commit f7a566992abdc8472d256073939a1d906b8530c0
parent 4d7bcedd7c366568ba19a0a58e3210614bfc22c0
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Sat, 27 Oct 2007 22:19:07 +0000
make snippets come from the latest reply instead of the earliest (thanks to Phil Snowberger)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@628 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sup/thread.rb b/lib/sup/thread.rb
@@ -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