Fixes the new tags/search route

Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
pull/666/head
Cyrille Bollu 2019-08-01 12:02:53 +02:00
rodzic f4ee2765b4
commit 23d1f5cc48
1 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -769,14 +769,15 @@ class LocalController extends Controller {
/* Look for an exactly matching account */ /* Look for an exactly matching account */
$match = null; $match = null;
try { try {
$match = $this->hashtagService->getHashtag($search); $match = $this->cacheActorService->getFromAccount($search, false);
$match->setCompleteDetails(true);
} catch (Exception $e) { } catch (Exception $e) {
} }
try { 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) { } catch (Exception $e) {
return $this->fail($e); return $this->fail($e);
} }
@ -799,20 +800,19 @@ class LocalController extends Controller {
} }
if ($search === '') { if ($search === '') {
return $this->success(['accounts' => [], 'exact' => []]); return $this->success(['tags' => [], 'exact' => []]);
} }
$match = null; $match = null;
try { try {
$match = $this->cacheActorService->getFromAccount($search, false); $match = $this->hashtagService->getHashtag($search);
$match->setCompleteDetails(true);
} catch (Exception $e) { } catch (Exception $e) {
} }
try { 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) { } catch (Exception $e) {
return $this->fail($e); return $this->fail($e);
} }