]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: do not show pagination footer for small inboxes
authorEric Wong <e@80x24.org>
Sat, 20 Aug 2022 08:01:33 +0000 (08:01 +0000)
committerEric Wong <e@80x24.org>
Sat, 20 Aug 2022 18:30:56 +0000 (18:30 +0000)
For new public inboxes with few messages, the dead pagination
footer is a worthless and confusing waste of space: "page: \n";
without `next' or `prev' links for users to follow.

lib/PublicInbox/View.pm

index 26094082996678975a5830876f00c0de431d9b91..c28505f111424fdd03fe5aa8175deb5ce4c575ba 100644 (file)
@@ -1192,7 +1192,7 @@ sub pagination_footer ($$) {
                $next = $next ? "$next | " : '             | ';
                $prev .= qq[ | <a\nhref="$latest">latest</a>];
        }
-       "<hr><pre>page: $next$prev</pre>";
+       ($next || $prev) ? \"<hr><pre>page: $next$prev</pre>" : \'';
 }
 
 sub paginate_recent ($$) {
@@ -1243,11 +1243,8 @@ sub paginate_recent ($$) {
 sub index_topics {
        my ($ctx) = @_;
        my $msgs = paginate_recent($ctx, 200); # 200 is our window
-       if (@$msgs) {
-               walk_thread(thread_results($ctx, $msgs), $ctx, \&acc_topic);
-       }
-       html_oneshot($ctx, dump_topics($ctx), \pagination_footer($ctx, '.'));
-
+       walk_thread(thread_results($ctx, $msgs), $ctx, \&acc_topic) if @$msgs;
+       html_oneshot($ctx, dump_topics($ctx), pagination_footer($ctx, '.'));
 }
 
 sub thread_adj_level {