Skip to content

Commit

Permalink
Add user profile picture boolean to capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed May 10, 2021
1 parent 9afe08e commit 0a44c69
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/files_sharing/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getCapabilities() {
if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
$res['api_enabled'] = false;
$res['public'] = ['enabled' => false];
$res['user'] = ['send_mail' => false];
$res['user'] = ['send_mail' => false, 'profile_picture' => true];
$res['resharing'] = false;
$res['can_share'] = false;
$res['providers_capabilities'] = false;
Expand Down Expand Up @@ -111,6 +111,7 @@ public function getCapabilities() {
$res["public"] = $public;

$res['user']['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_mail_notification', 'no') === 'yes';
$res['user']['profile_picture'] = true;
$res['user']['expire_date'] = [];
$res['user']['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date_user_share', 'no') === 'yes';
if ($res['user']['expire_date']['enabled']) {
Expand Down
9 changes: 9 additions & 0 deletions apps/files_sharing/tests/CapabilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function testDisabledSharingAPI() {
$this->assertFalse($result['can_share']);
$this->assertFalse($result['public']['enabled']);
$this->assertFalse($result['user']['send_mail']);
$this->assertTrue($result['user']['profile_picture']);
$this->assertFalse($result['resharing']);
}

Expand Down Expand Up @@ -313,6 +314,14 @@ public function testUserNoSendMail() {
$this->assertFalse($result['user']['send_mail']);
}

public function testProfilePictureCapability() {
$map = [
['core', 'shareapi_enabled', 'yes', 'yes']
];
$result = $this->getResults($map);
$this->assertTrue($result['user']['profile_picture']);
}

public function testResharing() {
$map = [
['core', 'shareapi_enabled', 'yes', 'yes'],
Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/38721
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Communicate user profile picture capability

Needed to tell the new frontend whether to fetch&render avatar images depending on the backend.

https://github.com/owncloud/core/pull/38721

0 comments on commit 0a44c69

Please sign in to comment.