From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 1AADE20713 for ; Wed, 6 Jul 2016 07:14:38 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 07/10] extmsg: switch to wwwstream for partial match, too Date: Wed, 6 Jul 2016 07:14:32 +0000 Message-Id: <20160706071435.18143-8-e@80x24.org> In-Reply-To: <20160706071435.18143-1-e@80x24.org> References: <20160706071435.18143-1-e@80x24.org> List-Id: Another step towards a consistent WWW UI... --- lib/PublicInbox/ExtMsg.pm | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index 4925a59..019d50a 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -104,14 +104,12 @@ again: my $h = PublicInbox::Hval->new_msgid($mid); my $href = $h->as_href; my $html = $h->as_html; - my $title = "Message-ID <$html> not found"; - my $s = "$title" . - "
$title\n";
-
+	my $title = "<$html> not found";
+	my $s = "
Message-ID <$html>\nnot found\n";
 	if ($n_partial) {
 		$code = 300;
 		my $es = $n_partial == 1 ? '' : 'es';
-		$s.= "\n$n_partial partial match$es found:\n\n";
+		$s .= "\n$n_partial partial match$es found:\n\n";
 		foreach my $pair (@partial) {
 			my ($ibx, $res) = @$pair;
 			my $u = $ibx->base_url or next;
@@ -123,21 +121,15 @@ again:
 			}
 		}
 	}
-
-	# Fall back to external repos if configured
-	if (@EXT_URL && index($mid, '@') >= 0) {
+	my $ext = ext_urls($ctx, $mid, $href, $html);
+	if ($ext ne '') {
+		$s .= $ext;
 		$code = 300;
-		$s .= "\nPerhaps try an external site:\n\n";
-		foreach my $url (@EXT_URL) {
-			my $u = PublicInbox::Hval::prurl($env, $url);
-			my $r = sprintf($u, $href);
-			my $t = sprintf($u, $html);
-			$s .= qq{$t\n};
-		}
 	}
-	$s .= '
'; - - [$code, ['Content-Type'=>'text/html; charset=UTF-8'], [$s]]; + $ctx->{-html_tip} = $s .= '
'; + $ctx->{-title_html} = $title; + $ctx->{-upfx} = '../'; + PublicInbox::WwwStream->response($ctx, $code); } sub ext_urls { -- EW