diff options
author | Eric Wong <e@80x24.org> | 2015-08-17 03:11:43 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-08-17 03:11:43 +0000 |
commit | 118ac5c2dc0e7a193ff58f2a9003636e1353583c (patch) | |
tree | 32ee08fb2cbd31aa02da6ab05cb647e70014fb34 /lib/PublicInbox/Feed.pm | |
parent | af0c513d49bae691f636b00efd1635b565b40c9d (diff) | |
parent | 9041b136ba7a106ed5ff33da4b6ae28c2a0f4333 (diff) | |
download | public-inbox-118ac5c2dc0e7a193ff58f2a9003636e1353583c.tar.gz |
* origin/search: view: deduplicate common code for loading search results SearchMsg: ensure metadata for ghost messages mid implement /s/$SUBJECT_PATH.html lookups search: remove unnecessary xpfx export www: /t/$MESSAGE_ID.html for threads view: hoist out index_walk function view: reply threading adjustment thread: common sorting code view: display replies in per-message view search: make search results more OO extract redundant Message-ID handling code search: implement index_sync to fixup indexer initial search backend implementation
Diffstat (limited to 'lib/PublicInbox/Feed.pm')
-rw-r--r-- | lib/PublicInbox/Feed.pm | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index f7c2f329..b5325597 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -73,11 +73,13 @@ sub generate_html_index { '</head><body>' . PRE_WRAP; # sort child messages in chronological order - $th->order(sub { mime_sort_children(@_) }); + $th->order(*PublicInbox::Thread::sort_ts); # except we sort top-level messages reverse chronologically my $state = [ time, {}, $first, 0 ]; - for (mime_sort_roots($th)) { dump_msg($_, 0, \$html, $state) } + for (PublicInbox::Thread::rsort_ts($th->rootset)) { + dump_msg($_, 0, \$html, $state) + } Email::Address->purge_cache; my $footer = nav_footer($args->{cgi}, $last, $feed_opts, $state); @@ -299,26 +301,9 @@ sub mime_load_for_sort { my $t = eval { str2time($mime->header('Date')) }; defined($t) or $t = 0; - $mime->header_set('X-PI-Date', $t); + $mime->header_set('X-PI-TS', $t); push @$messages, $mime; 1; } -# children are chronological -sub mime_sort_children { - sort { - $a->topmost->message->header('X-PI-Date') <=> - $b->topmost->message->header('X-PI-Date') - } @_; -} - -# parents are reverse chronological -sub mime_sort_roots { - my ($th) = @_; - sort { - (eval { $b->message->header('X-PI-Date') } || 0) <=> - (eval { $a->message->header('X-PI-Date') } || 0) - } $th->rootset; -} - 1; |