Catch NoAvatarException

This commit is contained in:
Daniel Supernault 2018-03-25 17:46:41 -06:00
parent 6a3e9a6df1
commit dbeb3d0ce7
1 changed files with 8 additions and 1 deletions

View File

@ -40,6 +40,13 @@ class ActivityPubActorAction extends ManagedAction
$profile = $user->getProfile();
$url = $profile->profileurl;
try {
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE)->displayUrl();
} catch (NoAvatarException $e) {
// TODO: fallback to current theme default avatar
$avatar = null;
}
$res = [
'@context' => [
"https://www.w3.org/ns/activitystreams",
@ -62,7 +69,7 @@ class ActivityPubActorAction extends ManagedAction
'type' => 'Image',
'width' => 96,
'height' => 96,
'url' => $profile->getAvatar(AVATAR_PROFILE_SIZE)->displayUrl()
'url' => $avatar
]
];