about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-02 02:37:23 +0000
committerEric Wong <e@80x24.org>2015-09-02 06:51:27 +0000
commitb872759b28cd4726b9f16f5214d042fdc50b1e93 (patch)
treef26f6f4a668df384ba6e4722d7eedef4058d013b /lib/PublicInbox/View.pm
parent1151816fc42c7d69c2417d58abb31d214ad06780 (diff)
downloadpublic-inbox-b872759b28cd4726b9f16f5214d042fdc50b1e93.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm14
1 files changed, 6 insertions, 8 deletions
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 = "<a\nid=\"s$final_anchor\">";
@@ -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(<<EOF);
-<html><head><title>$title</title></head><body><pre>$title
-<a href="../../">Return to index</a></pre></body></html>
-EOF
+        my ($cb, $ctx) = @_;
+        require PublicInbox::ExtMsg;
+
+        $cb->(PublicInbox::ExtMsg::ext_msg($ctx))
 }
 
 sub _msg_date {