From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 59106209B5 for ; Sat, 10 Dec 2016 03:43:06 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/7] view: favor SearchMsg for In-Reply-To over Email::MIME Date: Sat, 10 Dec 2016 03:43:00 +0000 Message-Id: <20161210034305.2654-3-e@80x24.org> In-Reply-To: <20161210034305.2654-1-e@80x24.org> References: <20161210034305.2654-1-e@80x24.org> List-Id: This should avoid warnings during thread skeleton generation if ever the Xapian database disagrees with View.pm about which is the proper direct parent of a message. We will treat the data in Xapian as the truth (if Xapian is available). --- lib/PublicInbox/View.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 2bfbb80..feac601 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -127,13 +127,13 @@ sub index_entry { my $id_m = 'm'.$id; my $root_anchor = $ctx->{root_anchor} || ''; - my $irt = in_reply_to($hdr); + my $irt; my $rv = "* "; $subj = ''.ascii_html($subj).''; $subj = "$subj" if $root_anchor eq $id_m; $rv .= $subj . "\n"; - $rv .= _th_index_lite($mid_raw, $irt, $id, $ctx); + $rv .= _th_index_lite($mid_raw, \$irt, $id, $ctx); my @tocc; foreach my $f (qw(To Cc)) { my $dst = _hdr_names($hdr, $f); @@ -147,7 +147,7 @@ sub index_entry { $rv .= ' '.join('; +', @tocc) . "\n" if @tocc; my $mapping = $ctx->{mapping}; - if (!$mapping && $irt) { + if (!$mapping && (defined($irt) || defined($irt = in_reply_to($hdr)))) { my $mirt = PublicInbox::Hval->new_msgid($irt); my $href = $upfx . $mirt->{href}. '/'; my $html = $mirt->as_html; @@ -206,7 +206,10 @@ sub _th_index_lite { my $nr_c = scalar @$children; my $nr_s = 0; my $siblings; - my $irt_map = $mapping->{$irt} if defined $irt; + if (my $smsg = $node->{smsg}) { + ($$irt) = (($smsg->{references} || '') =~ m/<([^>]+)>\z/); + } + my $irt_map = $mapping->{$$irt} if defined $$irt; if (defined $irt_map) { $siblings = $irt_map->[1]->{children}; $nr_s = scalar(@$siblings) - 1; -- EW