Merge pull request #12254 from MrPetovan/bug/reorder-search

Reorder search to try redirecting to post first
This commit is contained in:
Michael Vogel 2022-11-25 06:11:46 +01:00 committed by GitHub
commit 7c7cb8373c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -120,27 +120,27 @@ 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 {
if (strpos($search, '@') === 0 || strpos($search, '!') === 0) {
return self::performContactSearch($search);
}
self::tryRedirectToProfile($search); self::tryRedirectToPost($search);
if (strpos($search, '@') === 0 || strpos($search, '!') === 0) { self::tryRedirectToProfile($search);
return self::performContactSearch($search);
}
self::tryRedirectToPost($search); if (!empty($_GET['search-option'])) {
switch ($_GET['search-option']) {
if (!empty($_GET['search-option'])) { case 'fulltext':
switch ($_GET['search-option']) { break;
case 'fulltext': case 'tags':
break; $tag = true;
case 'tags': break;
$tag = true; case 'contacts':
break; return self::performContactSearch($search, '@');
case 'contacts': case 'forums':
return self::performContactSearch($search, '@'); return self::performContactSearch($search, '!');
case 'forums': }
return self::performContactSearch($search, '!');
} }
} }