From: Eric Wong Date: Fri, 2 Sep 2022 09:10:54 +0000 (+0000) Subject: www: omit [thread overview] link for unindexed v1 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=bedc22c355d570ed07ff6600717a97226f791ff5 www: omit [thread overview] link for unindexed v1 Unindexed v1 inboxes do not have the thread overview skeleton at the bottom of /$MSGID/ pages, so do not link to it. And for rare messages without a Date: header (or any headers!), this also ensures the [thread overview] is shown regardless. --- diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 11a94ba9..2b8e220b 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -717,7 +717,13 @@ sub _msg_page_prepare_obuf { for my $v ($eml->header('Date')) { $v = ascii_html($v); obfuscate_addrs($obfs_ibx, $v) if $obfs_ibx; # possible :P - $rv .= qq{Date: $v\t[thread overview]\n}; + $rv .= qq{Date: $v\n}; + } + # [thread overview] link is typically added after Date, + # but added after Subject, or even nothing. + if ($have_over) { + chop $rv; # drop "\n", or noop if $rv eq '' + $rv .= qq{\t[thread overview]\n}; } if (!$nr) { # first (and only) message, common case $ctx->{-title_html} = join(' - ', @title); diff --git a/t/plack.t b/t/plack.t index 3ba2e6fb..1cee286d 100644 --- a/t/plack.t +++ b/t/plack.t @@ -158,6 +158,8 @@ my $c1 = sub { like($html, qr!hihi - Me!, 'HTML returned'); like($html, qr!over'); $path .= 'f/'; $res = $cb->(GET($pfx . $path));