Merge pull request #216 from nextcloud/bugfix/noid/getaccount-catched

include the getAccount within the try/catch
pull/178/head^2
Maxence Lange 2018-12-12 10:01:56 -01:00 zatwierdzone przez GitHub
commit d0e6a8b220
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 5 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,17 @@ 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) {
$this->miscService->log(
'Issue while trying to updateCacheLocalActorName: ' . $e->getMessage(), 1
);
}
}