kopia lustrzana https://github.com/nextcloud/social
Merge pull request #1565 from nextcloud/fix-0106-search
ignore exception on unknown account during searchpull/1572/head
commit
c91aa1273b
|
@ -211,11 +211,11 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
||||||
*/
|
*/
|
||||||
public function searchAccounts(string $search): array {
|
public function searchAccounts(string $search): array {
|
||||||
$qb = $this->getCacheActorsSelectSql();
|
$qb = $this->getCacheActorsSelectSql();
|
||||||
$this->searchInAccount($qb, $search);
|
$qb->searchInAccount($search);
|
||||||
/** @var SocialQueryBuilder $qb */
|
/** @var SocialQueryBuilder $qb */
|
||||||
$qb->leftJoinCacheDocuments('icon_id');
|
$qb->leftJoinCacheDocuments('icon_id');
|
||||||
$this->leftJoinDetails($qb);
|
$this->leftJoinDetails($qb);
|
||||||
$this->limitResults($qb, 25);
|
$qb->limitResults(25);
|
||||||
|
|
||||||
return $this->getCacheActorsFromRequest($qb);
|
return $this->getCacheActorsFromRequest($qb);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,21 +83,18 @@ class SearchService {
|
||||||
* @return Person[]
|
* @return Person[]
|
||||||
*/
|
*/
|
||||||
public function searchAccounts(string $search): array {
|
public function searchAccounts(string $search): array {
|
||||||
$result = [];
|
|
||||||
$type = $this->getTypeFromSearch($search);
|
$type = $this->getTypeFromSearch($search);
|
||||||
|
|
||||||
if ($search === '' || !$type & self::SEARCH_ACCOUNTS) {
|
if ($search === '' || !$type & self::SEARCH_ACCOUNTS) {
|
||||||
return $result;
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (substr($search, 0, 1) === '@') {
|
$search = ltrim($search, '@');
|
||||||
$search = substr($search, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// search and cache eventual exact account first
|
||||||
$this->cacheActorService->getFromAccount($search);
|
$this->cacheActorService->getFromAccount($search);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->logger->notice('searchAccounts', ['exception' => $e, 'search' => $search]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->cacheActorService->searchCachedAccounts($search);
|
return $this->cacheActorService->searchCachedAccounts($search);
|
||||||
|
|
Ładowanie…
Reference in New Issue