about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-10 03:21:29 +0000
committerEric Wong <e@80x24.org>2016-12-10 03:23:43 +0000
commit275dc15b848eb3f51f10eb62fdec2d3ac8404e15 (patch)
tree25e383fb83079f317c070531795c4760ebb35b7e /lib/PublicInbox/View.pm
parent86c018672f6bf9739a76489c8870c151d338fc15 (diff)
downloadpublic-inbox-275dc15b848eb3f51f10eb62fdec2d3ac8404e15.tar.gz
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).
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 2bfbb808..feac6015 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 = "<a\nhref=#e$id\nid=m$id>*</a> ";
         $subj = '<b>'.ascii_html($subj).'</b>';
         $subj = "<u\nid=u>$subj</u>" 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;