From 63cafb59760fdb73a15c22210c59fe0f13d79e88 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 20 Aug 2022 08:01:33 +0000 Subject: view: do not show pagination footer for small inboxes 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 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/PublicInbox/View.pm') diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 26094082..c28505f1 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -1192,7 +1192,7 @@ sub pagination_footer ($$) { $next = $next ? "$next | " : ' | '; $prev .= qq[ | latest]; } - "
page: $next$prev
"; + ($next || $prev) ? \"
page: $next$prev
" : \''; } 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 { -- cgit v1.2.3-24-ge0c7