delete $ctx->{-list}; # reset if retried
my $pi_cfg = $ctx->{www}->{pi_cfg};
- if (defined(my $user_query = $q->{'q'})) {
+ my $user_query = $q->{'q'} // '';
+ if ($user_query =~ /\S/) {
$qs = "( $qs ) AND ( $user_query )";
} else { # special case for ALL
$ctx->ibx_entry($pi_cfg->ALL // die('BUG: ->ALL expected'), {});
$gzf->zmore('<pre>');
$gzf->zmore(join("\n", @$list));
$gzf->zmore(mset_footer($ctx, $mset)) if $mset;
+ } elsif (my $mset = delete $ctx->{-mset}) {
+ $gzf->zmore(mset_nav_top($ctx, $mset));
+ $gzf->zmore('<pre>no matching inboxes');
+ $gzf->zmore(mset_footer($ctx, $mset));
} else {
$gzf->zmore('<pre>no inboxes, yet');
}
is($res->code, 200, 'all.mbox.gz');
$res = $cb->(GET('/'));
- my $html = $res->content;
- like($html, qr!\Qhttp://bogus.example.com/all\E!, 'html shows /all');
+ like($res->content, qr!\Qhttp://bogus.example.com/all\E!,
+ '/all listed');
+ $res = $cb->(GET('/?q='));
+ is($res->code, 200, 'no query means all inboxes');
+ $res = $cb->(GET('/?q=nonexistent'));
+ is($res->code, 404, 'no inboxes matched');
+ unlike($res->content, qr!no inboxes, yet!,
+ 'we have inboxes, just no matches');
};
test_psgi(sub { $www->call(@_) }, $client);
%$env = (%$env, TMPDIR => $tmpdir, PI_CONFIG => $pi_config);