From: Eric Wong Date: Sat, 9 Jul 2016 08:01:17 +0000 (+0000) Subject: view: show most recently updated topics, first X-Git-Tag: v1.0.0~279 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=e634f3d6e168d157f205b938ab6a7c6c7564de07;p=public-inbox.git view: show most recently updated topics, first This probably makes the most sense as it's structured like a changelog. --- diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 5a312d84..3b041aab 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -879,14 +879,16 @@ sub acc_topic { sub dump_topics { my ($ctx) = @_; - my $order = $ctx->{order}; # [ ts, subj1, subj2, subj3, ... ] + my $order = delete $ctx->{order}; # [ ts, subj1, subj2, subj3, ... ] if (!@$order) { $ctx->{-html_tip} = '
[No topics in range]
'; return 404; } my @out; - foreach my $topic (@$order) { + + # sort by recency, this allows new posts to "bump" old topics... + foreach my $topic (sort { $b->[0] <=> $a->[0] } @$order) { my ($ts, $n, $seen, $top, @ex) = @$topic; @$topic = (); next unless defined $top; # ghost topic