From 9de63501549f69ee3858ab116c2728ca07820d20 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 23 Nov 2022 23:26:23 -0500 Subject: [PATCH] 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 --- src/Module/Search/Index.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php index f4e1db614..ec96b559a 100644 --- a/src/Module/Search/Index.php +++ b/src/Module/Search/Index.php @@ -120,27 +120,27 @@ class Index extends BaseSearch if (strpos($search, '#') === 0) { $tag = true; $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) { - return self::performContactSearch($search); - } + self::tryRedirectToProfile($search); - self::tryRedirectToPost($search); - - if (!empty($_GET['search-option'])) { - switch ($_GET['search-option']) { - case 'fulltext': - break; - case 'tags': - $tag = true; - break; - case 'contacts': - return self::performContactSearch($search, '@'); - case 'forums': - return self::performContactSearch($search, '!'); + if (!empty($_GET['search-option'])) { + switch ($_GET['search-option']) { + case 'fulltext': + break; + case 'tags': + $tag = true; + break; + case 'contacts': + return self::performContactSearch($search, '@'); + case 'forums': + return self::performContactSearch($search, '!'); + } } }