Fix: Search for terms and posts is now possible again
This commit is contained in:
parent
d6274ab6f7
commit
160f931861
1 changed files with 5 additions and 3 deletions
|
@ -215,9 +215,10 @@ class Index extends BaseSearchModule
|
||||||
*/
|
*/
|
||||||
private static function tryRedirectToProfile(BaseURL $baseURL, string $search)
|
private static function tryRedirectToProfile(BaseURL $baseURL, string $search)
|
||||||
{
|
{
|
||||||
$isUrl = parse_url($search, PHP_URL_SCHEME) !== '';
|
$isUrl = !empty(parse_url($search, PHP_URL_SCHEME));
|
||||||
$isAddr = preg_match('/^@?([a-z0-9.-_]+@[a-z0-9.-_:]+)$/i', trim($search), $matches);
|
$isAddr = (bool)preg_match('/^@?([a-z0-9.-_]+@[a-z0-9.-_:]+)$/i', trim($search), $matches);
|
||||||
|
|
||||||
|
Logger::info('Search', ['url' => $isUrl, 'addr' => $isAddr]);
|
||||||
if (!$isUrl && !$isAddr) {
|
if (!$isUrl && !$isAddr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +226,7 @@ class Index extends BaseSearchModule
|
||||||
if ($isAddr) {
|
if ($isAddr) {
|
||||||
$search = $matches[1];
|
$search = $matches[1];
|
||||||
}
|
}
|
||||||
|
Logger::info('Search', ['term' => $search]);
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
// User-specific contact URL/address search
|
// User-specific contact URL/address search
|
||||||
$contact_id = Contact::getIdForURL($search, local_user());
|
$contact_id = Contact::getIdForURL($search, local_user());
|
||||||
|
@ -246,6 +247,7 @@ class Index extends BaseSearchModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger::info('Search', ['cid' => $contact_id]);
|
||||||
if (!empty($contact_id)) {
|
if (!empty($contact_id)) {
|
||||||
$baseURL->redirect('contact/' . $contact_id);
|
$baseURL->redirect('contact/' . $contact_id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue