From a4b2403e293f0ed8f0a63892f9cd14929d28073e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 3 Sep 2020 15:46:21 +0200 Subject: [PATCH] The privacy setting is only about syncing to other servers Signed-off-by: Joas Schilling --- core/Controller/AvatarController.php | 15 --------- .../Core/Controller/AvatarControllerTest.php | 33 ------------------- 2 files changed, 48 deletions(-) diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index dc6febc467f..cbcb9783680 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -126,21 +126,6 @@ class AvatarController extends Controller { $size = 64; } - $user = $this->userManager->get($userId); - if ($user === null) { - return new JSONResponse([], Http::STATUS_NOT_FOUND); - } - - $account = $this->accountManager->getAccount($user); - $scope = $account->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope(); - - if ($scope !== IAccountManager::VISIBILITY_PUBLIC && $this->userId === null) { - // Public avatar access is not allowed - $response = new JSONResponse([], Http::STATUS_NOT_FOUND); - $response->cacheFor(1800); - return $response; - } - try { $avatar = $this->avatarManager->getAvatar($userId); $avatarFile = $avatar->getFile($size); diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index f070897e1b1..678648fa176 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -145,39 +145,6 @@ class AvatarControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); } - public function testAvatarNotPublic() { - $account = $this->createMock(IAccount::class); - $this->accountManager->method('getAccount') - ->with($this->userMock) - ->willReturn($account); - - $property = $this->createMock(IAccountProperty::class); - $account->method('getProperty') - ->with(IAccountManager::PROPERTY_AVATAR) - ->willReturn($property); - - $property->method('getScope') - ->willReturn(IAccountManager::VISIBILITY_PRIVATE); - - $controller = new AvatarController( - 'core', - $this->request, - $this->avatarManager, - $this->cache, - $this->l, - $this->userManager, - $this->rootFolder, - $this->logger, - null, - $this->timeFactory, - $this->accountManager - ); - - $result = $controller->getAvatar('userId', 128); - - $this->assertEquals(Http::STATUS_NOT_FOUND, $result->getStatus()); - } - /** * Fetch the user's avatar */ -- 2.39.5