Reorder search to try redirecting to post first

- Pleroma's post page includes the author's feed which wrongly gets picked up as a contact
- Address https://libranet.de/display/0b6b25a8-1563-7ec0-7408-70b986546395
This commit is contained in:
Hypolite Petovan 2022-11-23 23:26:23 -05:00
parent 849ce8f203
commit 9de6350154
1 changed files with 18 additions and 18 deletions

View File

@ -120,16 +120,15 @@ class Index extends BaseSearch
if (strpos($search, '#') === 0) { if (strpos($search, '#') === 0) {
$tag = true; $tag = true;
$search = substr($search, 1); $search = substr($search, 1);
} } else {
self::tryRedirectToProfile($search);
if (strpos($search, '@') === 0 || strpos($search, '!') === 0) { if (strpos($search, '@') === 0 || strpos($search, '!') === 0) {
return self::performContactSearch($search); return self::performContactSearch($search);
} }
self::tryRedirectToPost($search); self::tryRedirectToPost($search);
self::tryRedirectToProfile($search);
if (!empty($_GET['search-option'])) { if (!empty($_GET['search-option'])) {
switch ($_GET['search-option']) { switch ($_GET['search-option']) {
case 'fulltext': case 'fulltext':
@ -143,6 +142,7 @@ class Index extends BaseSearch
return self::performContactSearch($search, '!'); return self::performContactSearch($search, '!');
} }
} }
}
// Don't perform a fulltext or tag search on search results that look like an URL // Don't perform a fulltext or tag search on search results that look like an URL
// Tags don't look like an URL and the fulltext search does only work with natural words // Tags don't look like an URL and the fulltext search does only work with natural words