From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7DB311F601 for ; Fri, 2 Sep 2022 09:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1662109921; bh=wndu3ELvMfXyJPNysScjQFVQ7XCSPMsPbFdfY++XgQU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NjSniTN/oBwy5bvLGZVbk1WBIUkzQRvmUTNaVLH/+1qBDc/KP+2B1+ubrBPsptJP3 LBY5ubRn50BrUppi+dmsN2ofNix/G/YEcO8AdorUo4NsURCZT8JLhSAzCSws+rQbi9 jC1dCyvI2Gzd5OJvwZggoe+NVKbg+uLScVaUPXCM= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/2] www: omit [thread overview] link for unindexed v1 Date: Fri, 2 Sep 2022 09:10:54 +0000 Message-Id: <20220902091054.1527844-3-e@80x24.org> In-Reply-To: <20220902091054.1527844-1-e@80x24.org> References: <20220902091054.1527844-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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. --- lib/PublicInbox/View.pm | 8 +++++++- t/plack.t | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) 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));