From 23d1f5cc48d7687743ae7e90be3892dbfc339e43 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 1 Aug 2019 12:02:53 +0200 Subject: [PATCH] Fixes the new tags/search route Signed-off-by: Cyrille Bollu --- lib/Controller/LocalController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index 85ca430c..42bdd731 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -769,14 +769,15 @@ class LocalController extends Controller { /* Look for an exactly matching account */ $match = null; try { - $match = $this->hashtagService->getHashtag($search); + $match = $this->cacheActorService->getFromAccount($search, false); + $match->setCompleteDetails(true); } catch (Exception $e) { } try { - $tags = $this->hashtagService->searchHashtags($search); + $accounts = $this->cacheActorService->searchCachedAccounts($search); - return $this->success(['tags' => $tags, 'exact' => $match]); + return $this->success(['accounts' => $accounts, 'exact' => $match]); } catch (Exception $e) { return $this->fail($e); } @@ -799,20 +800,19 @@ class LocalController extends Controller { } if ($search === '') { - return $this->success(['accounts' => [], 'exact' => []]); + return $this->success(['tags' => [], 'exact' => []]); } $match = null; try { - $match = $this->cacheActorService->getFromAccount($search, false); - $match->setCompleteDetails(true); + $match = $this->hashtagService->getHashtag($search); } catch (Exception $e) { } try { - $accounts = $this->cacheActorService->searchCachedAccounts($search); + $tags = $this->hashtagService->searchHashtags($search); - return $this->success(['accounts' => $accounts, 'exact' => $match]); + return $this->success(['tags' => $tags, 'exact' => $match]); } catch (Exception $e) { return $this->fail($e); }