From f7a566992abdc8472d256073939a1d906b8530c0 Mon Sep 17 00:00:00 2001 From: wmorgan Date: Sat, 27 Oct 2007 22:19:07 +0000 Subject: [PATCH] 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 --- lib/sup/thread.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sup/thread.rb b/lib/sup/thread.rb index a0cf35d..230fe10 100644 --- 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 -- 2.45.2