kopia lustrzana https://github.com/nextcloud/social
ignore exception on unknown account
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/1565/head
rodzic
17062645bb
commit
5adda7cde3
lib
|
@ -211,11 +211,11 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
|||
*/
|
||||
public function searchAccounts(string $search): array {
|
||||
$qb = $this->getCacheActorsSelectSql();
|
||||
$this->searchInAccount($qb, $search);
|
||||
$qb->searchInAccount($search);
|
||||
/** @var SocialQueryBuilder $qb */
|
||||
$qb->leftJoinCacheDocuments('icon_id');
|
||||
$this->leftJoinDetails($qb);
|
||||
$this->limitResults($qb, 25);
|
||||
$qb->limitResults(25);
|
||||
|
||||
return $this->getCacheActorsFromRequest($qb);
|
||||
}
|
||||
|
|
|
@ -83,21 +83,18 @@ class SearchService {
|
|||
* @return Person[]
|
||||
*/
|
||||
public function searchAccounts(string $search): array {
|
||||
$result = [];
|
||||
$type = $this->getTypeFromSearch($search);
|
||||
|
||||
if ($search === '' || !$type & self::SEARCH_ACCOUNTS) {
|
||||
return $result;
|
||||
return [];
|
||||
}
|
||||
|
||||
if (substr($search, 0, 1) === '@') {
|
||||
$search = substr($search, 1);
|
||||
}
|
||||
$search = ltrim($search, '@');
|
||||
|
||||
try {
|
||||
// search and cache eventual exact account first
|
||||
$this->cacheActorService->getFromAccount($search);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->notice('searchAccounts', ['exception' => $e, 'search' => $search]);
|
||||
}
|
||||
|
||||
return $this->cacheActorService->searchCachedAccounts($search);
|
||||
|
|
Ładowanie…
Reference in New Issue