kopia lustrzana https://github.com/nextcloud/social
				
				
				
			setViewerId() to specify a PoV
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/82/head
							rodzic
							
								
									378a43d23e
								
							
						
					
					
						commit
						7d8e2b1065
					
				|  | @ -76,6 +76,10 @@ class PersonService implements ICoreService { | |||
| 	private $miscService; | ||||
| 
 | ||||
| 
 | ||||
| 	/** @var string */ | ||||
| 	private $viewerId = ''; | ||||
| 
 | ||||
| 
 | ||||
| 	/** | ||||
| 	 * UndoService constructor. | ||||
| 	 * | ||||
|  | @ -97,6 +101,18 @@ class PersonService implements ICoreService { | |||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @param string $viewerId | ||||
| 	 */ | ||||
| 	public function setViewerId(string $viewerId) { | ||||
| 		$this->viewerId = $viewerId; | ||||
| 	} | ||||
| 
 | ||||
| 	public function getViewerId(): string { | ||||
| 		return $this->viewerId; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @param Person $actor | ||||
| 	 * @param bool $refresh | ||||
|  | @ -169,7 +185,7 @@ class PersonService implements ICoreService { | |||
| 	public function getFromAccount(string $account, bool $retrieve = true): Person { | ||||
| 
 | ||||
| 		try { | ||||
| 			$actor = $this->cacheActorsRequest->getFromAccount($account); | ||||
| 			$actor = $this->cacheActorsRequest->getFromAccount($account, $this->getViewerId()); | ||||
| 		} catch (CacheActorDoesNotExistException $e) { | ||||
| 			if (!$retrieve) { | ||||
| 				throw new CacheActorDoesNotExistException(); | ||||
|  | @ -219,18 +235,7 @@ class PersonService implements ICoreService { | |||
| 		} | ||||
| 
 | ||||
| 		$actor->setSource(json_encode($object, JSON_UNESCAPED_SLASHES)); | ||||
| //			$actor->setPreferredUsername($this->get('preferredUsername', $object, ''));
 | ||||
| //			$actor->setPublicKey($this->get('publicKey.publicKeyPem', $object));
 | ||||
| //			$actor->setSharedInbox($this->get('endpoints.sharedInbox', $object));
 | ||||
| //			$actor->setAccount($actor->getPreferredUsername() . '@' . $this->get('_host', $object));
 | ||||
| //
 | ||||
| //			$icon = new Image($actor);
 | ||||
| //			$icon->setUrlCloud($this->configService->getCloudAddress());
 | ||||
| //			$icon->import($this->getArray('icon', $object, []));
 | ||||
| //			if ($icon->getType() === Image::TYPE) {
 | ||||
| //				$actor->setIcon($icon);
 | ||||
| //			}
 | ||||
| //
 | ||||
| 
 | ||||
| 		return $actor; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -240,7 +245,7 @@ class PersonService implements ICoreService { | |||
| 	 * @return Person[] | ||||
| 	 */ | ||||
| 	public function searchCachedAccounts(string $search): array { | ||||
| 		return $this->cacheActorsRequest->searchAccounts($search); | ||||
| 		return $this->cacheActorsRequest->searchAccounts($search, $this->getViewerId()); | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Maxence Lange
						Maxence Lange