From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS8972 188.138.9.0/24 X-Spam-Status: No, score=-1.8 required=3.0 tests=AWL,BAYES_00,RCVD_IN_XBL shortcircuit=no autolearn=no version=3.3.2 X-Original-To: meta@public-inbox.org Received: from 80x24.org (atlantic480.us.unmetered.com [188.138.9.49]) by dcvr.yhbt.net (Postfix) with ESMTP id 80788200F3 for ; Fri, 4 Sep 2015 02:18:27 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/7] view: avoid attempting to find "subject dummy" Date: Fri, 4 Sep 2015 02:18:09 +0000 Message-Id: <1441333091-32421-6-git-send-email-e@80x24.org> In-Reply-To: <1441333091-32421-1-git-send-email-e@80x24.org> References: <1441333091-32421-1-git-send-email-e@80x24.org> List-Id: This is an internal Message-ID used by Mail::Thread, to group messages with identical subjects but common parent. Don't attempt to redirect users to external sites when we cannot find it. --- lib/PublicInbox/View.pm | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 68adbd7..65ef1e7 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -591,6 +591,17 @@ sub pre_anchor_entry { $seen->{$id} = "#$id"; # save the anchor for children, later } +sub ghost_parent { + my ($upfx, $mid) = @_; + # 'subject dummy' is used internally by Mail::Thread + return '[no common parent]' if ($mid eq 'subject dummy'); + + $mid = PublicInbox::Hval->new_msgid($mid); + my $href = $mid->as_href; + my $html = $mid->as_html; + qq{[parent not found: <$html>]}; +} + sub __thread_entry { my ($cb, $git, $state, $mime, $level) = @_; @@ -607,15 +618,10 @@ sub __thread_entry { if (my $ghost = delete $state->{ghost}) { # n.b. ghost messages may only be parents, not children foreach my $g (@$ghost) { - my $mid = PublicInbox::Hval->new_msgid($g->[0]); - my $pfx = INDENT x $g->[1]; - my $href = $mid->as_href; - my $html = $mid->as_html; - $$cb->write("
$pfx" . - PRE_WRAP . - '[parent not found: <' . - qq{}. - "$html>]
"); + $$cb->write("" . + (INDENT x $g->[1]) . "" . + PRE_WRAP . ghost_parent('', $g->[0]) . + ''); } } index_entry($$cb, $mime, $level, $state); @@ -736,12 +742,7 @@ sub inline_dump { _inline_header($dst, $state, $upfx, $mime, $level); } else { my $pfx = INDENT x $level; - my $v = PublicInbox::Hval->new_msgid($node->messageid, 1); - my $html = $v->as_html; - my $href = $v->as_href; - $$dst .= $pfx . '` [parent not found: <' . - qq{}. - "$html>]\n"; + $$dst .= $pfx . '` ' . ghost_parent($upfx, $node->messageid); } inline_dump($dst, $state, $upfx, $node->child, $level+1); inline_dump($dst, $state, $upfx, $node->next, $level); -- EW