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 authored and phil-davis committed May 11, 2021
1 parent eb3deef commit 4418879
Show file tree
Hide file tree
Showing 4 changed files with 25 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
6 changes: 6 additions & 0 deletions changelog/unreleased/38722
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Communicate user profile picture capability

A new capability "profile_picture" has been added so that clients can know
whether to fetch and render avatar images of users.

https://github.com/owncloud/core/pull/38722
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ Feature: capabilities
| files | file_locking_support | 1 |
| files | file_locking_enable_file_action | 1 |

@smokeTest @skipOnOcV10.6 @skipOnOcV10.7.0
# These are new capabilities after 10.7.0
Scenario: getting default capabilities with admin user
When the administrator retrieves the capabilities using the capabilities API
Then the capabilities should contain
| capability | path_to_element | value |
| files_sharing | user@@@profile_picture | 1 |

@files_trashbin-app-required
Scenario: getting trashbin app capability with admin user
When the administrator retrieves the capabilities using the capabilities API
Expand Down

0 comments on commit 4418879

Please sign in to comment.