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
					
				|  | @ -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
	
	 Maxence Lange
						Maxence Lange