]> git.mxchange.org Git - friendica.git/commitdiff
Reorder search to try redirecting to post first
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 24 Nov 2022 04:26:23 +0000 (23:26 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 25 Nov 2022 03:21:51 +0000 (22:21 -0500)
- 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

index f4e1db614838f430f1b370c5481c3336b39aab01..ec96b559a703a349992416ce41a15f213eec72cc 100644 (file)
@@ -120,27 +120,27 @@ class Index extends BaseSearch
                if (strpos($search, '#') === 0) {
                        $tag = true;
                        $search = substr($search, 1);
-               }
-
-               self::tryRedirectToProfile($search);
-
-               if (strpos($search, '@') === 0 || strpos($search, '!') === 0) {
-                       return self::performContactSearch($search);
-               }
+               } else {
+                       if (strpos($search, '@') === 0 || strpos($search, '!') === 0) {
+                               return self::performContactSearch($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, '!');
+                       self::tryRedirectToPost($search);
+
+                       self::tryRedirectToProfile($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, '!');
+                               }
                        }
                }