Use guest avatar if visibility settings are not set to public

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-01-14 16:24:18 +01:00
parent 092a1fb90f
commit 3f9b88bf7f
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 4 additions and 3 deletions

View File

@ -133,12 +133,13 @@ class AvatarController extends Controller {
$scope = $account->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope();
if ($scope !== IAccountManager::VISIBILITY_PUBLIC && $this->userId === null) {
// Public avatar access is not allowed
return new JSONResponse([], Http::STATUS_NOT_FOUND);
// Public avatar access is not allowed, fallback to guest avatar
$avatar = $this->avatarManager->getGuestAvatar($userId);
} else {
$avatar = $this->avatarManager->getAvatar($userId);
}
try {
$avatar = $this->avatarManager->getAvatar($userId);
$avatarFile = $avatar->getFile($size);
$resp = new FileDisplayResponse(
$avatarFile,