diff --git a/src/Module/BaseSearch.php b/src/Module/BaseSearch.php index cc8fab8f7..675deb8fb 100644 --- a/src/Module/BaseSearch.php +++ b/src/Module/BaseSearch.php @@ -97,6 +97,8 @@ class BaseSearch extends BaseModule } elseif (Search::getGlobalDirectory() && empty($results)) { $results = Search::getContactsFromGlobalDirectory($search, $type, $pager->getPage()); $pager->setItemsPerPage($results->getItemsPage()); + } else { + $results = new ResultList(); } return self::printResult($results, $pager, $header); @@ -120,11 +122,17 @@ class BaseSearch extends BaseModule return ''; } + $filtered = 0; + $entries = []; foreach ($results->getResults() as $result) { - // in case the result is a contact result, add a contact-specific entry if ($result instanceof ContactResult) { + if (Network::isUriBlocked($result->getUrl())) { + $filtered++; + continue; + } + $contact = Model\Contact::getByURLForUser($result->getUrl(), DI::userSession()->getLocalUserId()); if (!empty($contact)) { $entries[] = Contact::getContactTemplateVars($contact); @@ -134,7 +142,11 @@ class BaseSearch extends BaseModule $tpl = Renderer::getMarkupTemplate('contact/list.tpl'); return Renderer::replaceMacros($tpl, [ - 'title' => $header, + '$title' => $header, + '$filtered' => $filtered ? DI::l10n()->tt( + '%d result was filtered out because your node blocks the domain it is registered on. You can review the list of domains your node is currently blocking in the About page.', + '%d results were filtered out because your node blocks the domain they are registered on. You can review the list of domains your node is currently blocking in the About page.', + $filtered) : '', '$contacts' => $entries, '$paginate' => $pager->renderFull($results->getTotal()), ]); diff --git a/view/templates/contact/list.tpl b/view/templates/contact/list.tpl index ec77fd521..b3ed7df7b 100644 --- a/view/templates/contact/list.tpl +++ b/view/templates/contact/list.tpl @@ -12,3 +12,7 @@
{{$paginate nofilter}} + +{{if $filtered}} +{{$filtered nofilter}}
+{{/if}} diff --git a/view/theme/frio/templates/contact/list.tpl b/view/theme/frio/templates/contact/list.tpl index 1925f7ec4..1258ded36 100644 --- a/view/theme/frio/templates/contact/list.tpl +++ b/view/theme/frio/templates/contact/list.tpl @@ -14,4 +14,8 @@ at the suggest page and also at many other places *}} {{$paginate nofilter}} - \ No newline at end of file + +{{if $filtered}} +{{$filtered nofilter}}
+{{/if}} +