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 353411F624 for ; Mon, 29 Aug 2022 09:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1661765209; bh=fblPhmH4dFIkSywXn6SXC/9RosEC4IA1uDt0GISMDzY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=0pSEUT43bL1hxM7obKYB6VwTMwCID9lZCn6T36SZOMmWMAh6DCoa/BV9ZcNe3gXRK Ysime7OpxytTN5EoS8/hCRpbba8gJe/uC8CMW0pAxcSQRvQbdGwuR5W8qgn+L3w0gX GEH0AgvSgdEHUjm5UohBZfmLU2ab82yNdZsjNIOw= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 12/18] www: atom: fix "changed" href to nowhere Date: Mon, 29 Aug 2022 09:26:41 +0000 Message-Id: <20220829092647.1512215-13-e@80x24.org> In-Reply-To: <20220829092647.1512215-1-e@80x24.org> References: <20220829092647.1512215-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The HTML generated for the Atom feed doesn't have the footer of /T/ and /t/ HTML-only views, so just make "changed" in the diffstat go directly to the permalink #related anchor. Fixes: 66512e177390 ("view: generate query in single-message and commit views") --- lib/PublicInbox/View.pm | 2 +- lib/PublicInbox/ViewDiff.pm | 4 ++-- lib/PublicInbox/WwwAtomStream.pm | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 354cdd93..86f4a467 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -248,7 +248,7 @@ sub eml_entry { # scan through all parts, looking for displayable text $ctx->{mhref} = $mhref; - $ctx->{end_id} = "e$id"; + $ctx->{changed_href} = "#e$id"; # for diffstat "files? changed," $ctx->{obuf} = \$rv; $eml->each_part(\&add_text_body, $ctx, 1); delete $ctx->{obuf}; diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index ee2d688c..8c1853e6 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -180,8 +180,8 @@ sub diff_before_or_after ($$) { $$dst .= $linkify->to_html($l); } $$dst .= $x[2]; # $3 /^ \d+ files? / - my $end = $ctx->{end_id} // 'related'; - $$dst .= "changed,"; + my $ch = $ctx->{changed_href} // '#related'; + $$dst .= qq(changed,); $$dst .= ascii_html($x[1]); # $4: insertions/deletions $$dst .= $linkify->to_html($x[0]); # notes, commit message, etc } else { diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm index 7b7047ac..09b6facb 100644 --- a/lib/PublicInbox/WwwAtomStream.pm +++ b/lib/PublicInbox/WwwAtomStream.pm @@ -156,6 +156,7 @@ sub feed_entry { qq(); $ctx->{obuf} = \$s; $ctx->{mhref} = $href; + $ctx->{changed_href} = "${href}#related"; PublicInbox::View::multipart_text_as_html($eml, $ctx); delete $ctx->{obuf}; $s .= '';