include the getAccount within the try/catch

pull/216/head
Maxence Lange 2018-12-12 08:44:13 -01:00
rodzic 87252d92bb
commit 2c7cdcb702
1 zmienionych plików z 2 dodań i 3 usunięć

Wyświetl plik

@ -45,7 +45,6 @@ use OCA\Social\Model\ActivityPub\Person;
use OCA\Social\Service\ActivityPub\DocumentService;
use OCA\Social\Service\ActivityPub\PersonService;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\PropertyDoesNotExistException;
use OCP\IUserManager;
@ -287,14 +286,14 @@ class ActorService {
*/
private function updateCacheLocalActorName(Person &$actor) {
$user = $this->userManager->get($actor->getUserId());
$account = $this->accountManager->getAccount($user);
try {
$account = $this->accountManager->getAccount($user);
$displayNameProperty = $account->getProperty(IAccountManager::PROPERTY_DISPLAYNAME);
if ($displayNameProperty->getScope() === IAccountManager::VISIBILITY_PUBLIC) {
$actor->setName($displayNameProperty->getValue());
}
} catch (PropertyDoesNotExistException $e) {
} catch (Exception $e) {
}
}