]> Sergey Matveev's repositories - public-inbox.git/commitdiff
www: atom: fix "changed" href to nowhere
authorEric Wong <e@80x24.org>
Mon, 29 Aug 2022 09:26:41 +0000 (09:26 +0000)
committerEric Wong <e@80x24.org>
Mon, 29 Aug 2022 19:05:51 +0000 (19:05 +0000)
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
lib/PublicInbox/ViewDiff.pm
lib/PublicInbox/WwwAtomStream.pm

index 354cdd93ef14939b567eef1538a54a76996af8e2..86f4a4672590364ecafa85f92176980f242fff93 100644 (file)
@@ -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};
index ee2d688c4584f0515f7b25c0547bc4ded9b86c17..8c1853e625557872003af9d74cad0fc13cc3875a 100644 (file)
@@ -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 .= "<a href=#$end>changed</a>,";
+               my $ch = $ctx->{changed_href} // '#related';
+               $$dst .= qq(<a href="$ch">changed</a>,);
                $$dst .= ascii_html($x[1]); # $4: insertions/deletions
                $$dst .= $linkify->to_html($x[0]); # notes, commit message, etc
        } else {
index 7b7047ac26d39e9647d3866d3a65801ca2dbaf54..09b6facbb337da0119ec063524a5dbd06373a323 100644 (file)
@@ -156,6 +156,7 @@ sub feed_entry {
                qq(<pre\nstyle="white-space:pre-wrap">);
        $ctx->{obuf} = \$s;
        $ctx->{mhref} = $href;
+       $ctx->{changed_href} = "${href}#related";
        PublicInbox::View::multipart_text_as_html($eml, $ctx);
        delete $ctx->{obuf};
        $s .= '</pre></div></content></entry>';