]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: drop redundant References: display code
authorEric Wong <e@80x24.org>
Mon, 23 Apr 2018 04:16:54 +0000 (04:16 +0000)
committerEric Wong <e@80x24.org>
Mon, 23 Apr 2018 04:17:10 +0000 (04:17 +0000)
We no longer need to parse and dedupe References:
ourselves, PublicInbox::MID::references does it for us.

lib/PublicInbox/View.pm

index 7339467120205679175462e2a716f84588ef37df..58851edc59f5226bc47a4c6ba3f7627a19ba3e00 100644 (file)
@@ -723,7 +723,8 @@ sub _parent_headers {
        my ($hdr, $srch) = @_;
        my $rv = '';
 
        my ($hdr, $srch) = @_;
        my $rv = '';
 
-       my $irt = in_reply_to($hdr);
+       my $refs = references($hdr);
+       my $irt = pop @$refs;
        if (defined $irt) {
                my $v = PublicInbox::Hval->new_msgid($irt);
                my $html = $v->as_html;
        if (defined $irt) {
                my $v = PublicInbox::Hval->new_msgid($irt);
                my $html = $v->as_html;
@@ -736,22 +737,9 @@ sub _parent_headers {
        # we show the thread skeleton at the bottom, instead.
        return $rv if $srch;
 
        # we show the thread skeleton at the bottom, instead.
        return $rv if $srch;
 
-       my $refs = $hdr->header_raw('References');
-       if ($refs) {
-               # avoid redundant URLs wasting bandwidth
-               my %seen;
-               $seen{$irt} = 1 if defined $irt;
-               my @refs;
-               my @raw_refs = ($refs =~ /<([^>]+)>/g);
-               foreach my $ref (@raw_refs) {
-                       next if $seen{$ref};
-                       $seen{$ref} = 1;
-                       push @refs, linkify_ref_nosrch($ref);
-               }
-
-               if (@refs) {
-                       $rv .= 'References: '. join("\n\t", @refs) . "\n";
-               }
+       if (@$refs) {
+               @$refs = map { linkify_ref_nosrch($_) } @$refs;
+               $rv .= 'References: '. join("\n\t", @$refs) . "\n";
        }
        $rv;
 }
        }
        $rv;
 }