Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user profile picture boolean to capabilities #38722

Merged
merged 1 commit into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
phil-davis marked this conversation as resolved.
Show resolved Hide resolved

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