From b872759b28cd4726b9f16f5214d042fdc50b1e93 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 2 Sep 2015 02:37:23 +0000 Subject: implement external Message-ID finder Currently, this looks at other public-inbox configurations served in the same process. In the future, it will generate links to other Message-ID lookup endpoints. --- lib/PublicInbox/View.pm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lib/PublicInbox/View.pm') diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 1528a874..e18895f1 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -164,7 +164,7 @@ sub emit_thread_html { my $res = $srch->get_thread($mid); my $msgs = load_results($res); my $nr = scalar @$msgs; - return missing_thread($cb) if $nr == 0; + return missing_thread($cb, $ctx) if $nr == 0; my $flat = $ctx->{flat}; my $orig_cb = $cb; my $seen = {}; @@ -189,7 +189,7 @@ sub emit_thread_html { # there could be a race due to a message being deleted in git # but still being in the Xapian index: - return missing_thread($cb) if ($orig_cb eq $cb); + return missing_thread($cb, $ctx) if ($orig_cb eq $cb); my $final_anchor = $state->{anchor_idx}; my $next = ""; @@ -637,12 +637,10 @@ sub thread_results { } sub missing_thread { - my ($cb) = @_; - my $title = 'Thread does not exist'; - $cb->([404, ['Content-Type' => 'text/html']])->write(<$title
$title
-Return to index
-EOF + my ($cb, $ctx) = @_; + require PublicInbox::ExtMsg; + + $cb->(PublicInbox::ExtMsg::ext_msg($ctx)) } sub _msg_date { -- cgit v1.2.3-24-ge0c7