Filter contact search by blocked remote domains
- Add filter explanation
This commit is contained in:
parent
261ba161a2
commit
03b7fcd09c
|
@ -97,6 +97,8 @@ class BaseSearch extends BaseModule
|
||||||
} elseif (Search::getGlobalDirectory() && empty($results)) {
|
} elseif (Search::getGlobalDirectory() && empty($results)) {
|
||||||
$results = Search::getContactsFromGlobalDirectory($search, $type, $pager->getPage());
|
$results = Search::getContactsFromGlobalDirectory($search, $type, $pager->getPage());
|
||||||
$pager->setItemsPerPage($results->getItemsPage());
|
$pager->setItemsPerPage($results->getItemsPage());
|
||||||
|
} else {
|
||||||
|
$results = new ResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::printResult($results, $pager, $header);
|
return self::printResult($results, $pager, $header);
|
||||||
|
@ -120,11 +122,17 @@ class BaseSearch extends BaseModule
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$filtered = 0;
|
||||||
|
|
||||||
$entries = [];
|
$entries = [];
|
||||||
foreach ($results->getResults() as $result) {
|
foreach ($results->getResults() as $result) {
|
||||||
|
|
||||||
// in case the result is a contact result, add a contact-specific entry
|
// in case the result is a contact result, add a contact-specific entry
|
||||||
if ($result instanceof ContactResult) {
|
if ($result instanceof ContactResult) {
|
||||||
|
if (Network::isUriBlocked($result->getUrl())) {
|
||||||
|
$filtered++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$contact = Model\Contact::getByURLForUser($result->getUrl(), DI::userSession()->getLocalUserId());
|
$contact = Model\Contact::getByURLForUser($result->getUrl(), DI::userSession()->getLocalUserId());
|
||||||
if (!empty($contact)) {
|
if (!empty($contact)) {
|
||||||
$entries[] = Contact::getContactTemplateVars($contact);
|
$entries[] = Contact::getContactTemplateVars($contact);
|
||||||
|
@ -134,7 +142,11 @@ class BaseSearch extends BaseModule
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('contact/list.tpl');
|
$tpl = Renderer::getMarkupTemplate('contact/list.tpl');
|
||||||
return Renderer::replaceMacros($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 <a href="/friendica">About page</a>.',
|
||||||
|
'%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 <a href="/friendica">About page</a>.',
|
||||||
|
$filtered) : '',
|
||||||
'$contacts' => $entries,
|
'$contacts' => $entries,
|
||||||
'$paginate' => $pager->renderFull($results->getTotal()),
|
'$paginate' => $pager->renderFull($results->getTotal()),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -12,3 +12,7 @@
|
||||||
<div id="view-contact-end"></div>
|
<div id="view-contact-end"></div>
|
||||||
|
|
||||||
{{$paginate nofilter}}
|
{{$paginate nofilter}}
|
||||||
|
|
||||||
|
{{if $filtered}}
|
||||||
|
<p>{{$filtered nofilter}}</p>
|
||||||
|
{{/if}}
|
||||||
|
|
|
@ -14,4 +14,8 @@ at the suggest page and also at many other places *}}
|
||||||
<div id="view-contact-end"></div>
|
<div id="view-contact-end"></div>
|
||||||
|
|
||||||
{{$paginate nofilter}}
|
{{$paginate nofilter}}
|
||||||
|
|
||||||
|
{{if $filtered}}
|
||||||
|
<p>{{$filtered nofilter}}</p>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue
Block a user