summaryrefslogtreecommitdiffstats
path: root/apps/settings
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-03-23 16:59:05 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-03-29 07:03:32 +0000
commit5c854ba13291c4eecb87ac7a5235304711e5cbbe (patch)
tree20a1cd99c4da9bb9742bbb045811364e1406d1dd /apps/settings
parent5d76574a81197e00cf4d0e781d41a311a76f37fc (diff)
downloadnextcloud-server-5c854ba13291c4eecb87ac7a5235304711e5cbbe.tar.gz
nextcloud-server-5c854ba13291c4eecb87ac7a5235304711e5cbbe.zip
Make extra user profile fields always editable
The fields for phone number, address, website and twitter are now editable regardless whether federated sharing and the lookup server are enabled or not. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/settings')
-rw-r--r--apps/settings/lib/Controller/UsersController.php15
-rw-r--r--apps/settings/templates/settings/personal/personal.info.php22
-rw-r--r--apps/settings/tests/Controller/UsersControllerTest.php1
3 files changed, 8 insertions, 30 deletions
diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php
index 02a0cda139e..c59c16666f2 100644
--- a/apps/settings/lib/Controller/UsersController.php
+++ b/apps/settings/lib/Controller/UsersController.php
@@ -46,7 +46,6 @@ use OC\KnownUser\KnownUserService;
use OC\L10N\Factory;
use OC\Security\IdentityProof\Manager;
use OC\User\Manager as UserManager;
-use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Settings\BackgroundJobs\VerifyUserData;
use OCA\Settings\Events\BeforeTemplateRenderedEvent;
use OCA\User_LDAP\User_Proxy;
@@ -401,15 +400,11 @@ class UsersController extends Controller {
$data[IAccountManager::PROPERTY_DISPLAYNAME] = ['value' => $displayname, 'scope' => $displaynameScope];
$data[IAccountManager::PROPERTY_EMAIL] = ['value' => $email, 'scope' => $emailScope];
}
- if ($this->appManager->isEnabledForUser('federatedfilesharing')) {
- $shareProvider = \OC::$server->query(FederatedShareProvider::class);
- if ($shareProvider->isLookupServerUploadEnabled()) {
- $data[IAccountManager::PROPERTY_WEBSITE] = ['value' => $website, 'scope' => $websiteScope];
- $data[IAccountManager::PROPERTY_ADDRESS] = ['value' => $address, 'scope' => $addressScope];
- $data[IAccountManager::PROPERTY_PHONE] = ['value' => $phone, 'scope' => $phoneScope];
- $data[IAccountManager::PROPERTY_TWITTER] = ['value' => $twitter, 'scope' => $twitterScope];
- }
- }
+ $data[IAccountManager::PROPERTY_WEBSITE] = ['value' => $website, 'scope' => $websiteScope];
+ $data[IAccountManager::PROPERTY_ADDRESS] = ['value' => $address, 'scope' => $addressScope];
+ $data[IAccountManager::PROPERTY_PHONE] = ['value' => $phone, 'scope' => $phoneScope];
+ $data[IAccountManager::PROPERTY_TWITTER] = ['value' => $twitter, 'scope' => $twitterScope];
+
try {
$data = $this->saveUserSettings($user, $data);
if ($beforeData[IAccountManager::PROPERTY_PHONE]['value'] !== $data[IAccountManager::PROPERTY_PHONE]['value']) {
diff --git a/apps/settings/templates/settings/personal/personal.info.php b/apps/settings/templates/settings/personal/personal.info.php
index 60db8c85333..f2e3a51aad7 100644
--- a/apps/settings/templates/settings/personal/personal.info.php
+++ b/apps/settings/templates/settings/personal/personal.info.php
@@ -177,7 +177,6 @@ script('settings', [
<?php } ?>
</form>
</div>
- <?php if (!empty($_['phone']) || $_['lookupServerUploadEnabled']) { ?>
<div class="personal-settings-setting-box">
<form id="phoneform" class="section">
<h3>
@@ -188,9 +187,7 @@ script('settings', [
</span>
</div>
</h3>
- <input type="tel" id="phone" name="phone" <?php if (!$_['lookupServerUploadEnabled']) {
- print_unescaped('disabled="1"');
- } ?>
+ <input type="tel" id="phone" name="phone"
value="<?php p($_['phone']) ?>"
placeholder="<?php p($l->t('Your phone number')); ?>"
autocomplete="on" autocapitalize="none" autocorrect="off" />
@@ -199,8 +196,6 @@ script('settings', [
<input type="hidden" id="phonescope" value="<?php p($_['phoneScope']) ?>">
</form>
</div>
- <?php } ?>
- <?php if (!empty($_['address']) || $_['lookupServerUploadEnabled']) { ?>
<div class="personal-settings-setting-box">
<form id="addressform" class="section">
<h3>
@@ -211,9 +206,7 @@ script('settings', [
</span>
</div>
</h3>
- <input type="text" id="address" name="address" <?php if (!$_['lookupServerUploadEnabled']) {
- print_unescaped('disabled="1"');
- } ?>
+ <input type="text" id="address" name="address"
placeholder="<?php p($l->t('Your postal address')); ?>"
value="<?php p($_['address']) ?>"
autocomplete="on" autocapitalize="none" autocorrect="off" />
@@ -222,8 +215,6 @@ script('settings', [
<input type="hidden" id="addressscope" value="<?php p($_['addressScope']) ?>">
</form>
</div>
- <?php } ?>
- <?php if (!empty($_['website']) || $_['lookupServerUploadEnabled']) { ?>
<div class="personal-settings-setting-box">
<form id="websiteform" class="section">
<h3>
@@ -267,17 +258,12 @@ script('settings', [
<input type="url" name="website" id="website" value="<?php p($_['website']); ?>"
placeholder="<?php p($l->t('Link https://…')); ?>"
autocomplete="on" autocapitalize="none" autocorrect="off"
- <?php if (!$_['lookupServerUploadEnabled']) {
- print_unescaped('disabled="1"');
- } ?>
/>
<span class="icon-checkmark hidden"></span>
<span class="icon-error hidden" ></span>
<input type="hidden" id="websitescope" value="<?php p($_['websiteScope']) ?>">
</form>
</div>
- <?php } ?>
- <?php if (!empty($_['twitter']) || $_['lookupServerUploadEnabled']) { ?>
<div class="personal-settings-setting-box">
<form id="twitterform" class="section">
<h3>
@@ -321,16 +307,12 @@ script('settings', [
<input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>"
placeholder="<?php p($l->t('Twitter handle @…')); ?>"
autocomplete="on" autocapitalize="none" autocorrect="off"
- <?php if (!$_['lookupServerUploadEnabled']) {
- print_unescaped('disabled="1"');
- } ?>
/>
<span class="icon-checkmark hidden"></span>
<span class="icon-error hidden" ></span>
<input type="hidden" id="twitterscope" value="<?php p($_['twitterScope']) ?>">
</form>
</div>
- <?php } ?>
</div>
<div class="profile-settings-container">
diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php
index 2daf383410e..f9652053de8 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -190,6 +190,7 @@ class UsersControllerTest extends \Test\TestCase {
public function testSetUserSettings($email, $validEmail, $expectedStatus) {
$controller = $this->getController(false, ['saveUserSettings']);
$user = $this->createMock(IUser::class);
+ $user->method('getUID')->willReturn('johndoe');
$this->userSession->method('getUser')->willReturn($user);