From: Eric Wong <e@80x24.org>
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 [thread overview]
Message-ID: <20161210034305.2654-3-e@80x24.org> (raw)
In-Reply-To: <20161210034305.2654-1-e@80x24.org>
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 = "<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;
--
EW
next prev parent reply other threads:[~2016-12-10 3:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-10 3:42 [PATCH 0/7] message threading fixes for WWW UI Eric Wong
2016-12-10 3:42 ` [PATCH 1/7] search: favor In-Reply-To over last References iff IRT exists Eric Wong
2016-12-10 3:43 ` Eric Wong [this message]
2016-12-10 3:43 ` [PATCH 3/7] thread: fix comment describing its existence Eric Wong
2016-12-10 3:43 ` [PATCH 4/7] view: reduce indentation for skeleton generation Eric Wong
2016-12-10 3:43 ` [PATCH 5/7] view: skip ghosts with no direct children Eric Wong
2016-12-10 3:43 ` [PATCH 6/7] thread: last Reference always wins Eric Wong
2016-12-10 3:43 ` [PATCH 7/7] search: always sort thread results in ascending time order Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161210034305.2654-3-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).