From c5c70daa663cab80eb362b0312099fc2e71312e9 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Fri, 15 Jul 2022 04:17:20 +0000 Subject: [PATCH] Modularize shared account property components Signed-off-by: Christopher Ng --- .../lib/Settings/Personal/PersonalInfo.php | 12 +- .../BiographySection.vue | 38 +-- .../BiographySection/Biography.vue | 184 ------------ .../PersonalInfo/DisplayNameSection.vue | 66 +++++ .../DisplayNameSection/DisplayName.vue | 180 ------------ .../DisplayNameSection/DisplayNameSection.vue | 86 ------ .../PersonalInfo/EmailSection/Email.vue | 14 +- .../EmailSection/EmailSection.vue | 22 +- .../{HeadlineSection => }/HeadlineSection.vue | 37 +-- .../PersonalInfo/HeadlineSection/Headline.vue | 175 ------------ .../PersonalInfo/LanguageSection/Language.vue | 14 +- .../LanguageSection/LanguageSection.vue | 19 +- .../OrganisationSection.vue | 37 +-- .../OrganisationSection/Organisation.vue | 175 ------------ .../ProfileSection/ProfileCheckbox.vue | 8 +- .../ProfileSection/ProfileSection.vue | 14 +- .../ProfileVisibilitySection.vue | 8 +- .../VisibilityDropdown.vue | 9 +- .../{RoleSection => }/RoleSection.vue | 37 +-- .../PersonalInfo/RoleSection/Role.vue | 175 ------------ .../shared/AccountPropertySection.vue | 265 ++++++++++++++++++ .../PersonalInfo/shared/FederationControl.vue | 30 +- .../PersonalInfo/shared/HeaderBar.vue | 40 +-- .../src/constants/AccountPropertyConstants.js | 16 ++ apps/settings/src/main-personal-info.js | 18 +- apps/settings/src/utils/validate.js | 12 - ...tings-vue-settings-admin-basic-settings.js | 4 +- ...s-vue-settings-admin-basic-settings.js.map | 2 +- dist/settings-vue-settings-personal-info.js | 4 +- ...settings-vue-settings-personal-info.js.map | 2 +- 30 files changed, 502 insertions(+), 1201 deletions(-) rename apps/settings/src/components/PersonalInfo/{BiographySection => }/BiographySection.vue (54%) delete mode 100644 apps/settings/src/components/PersonalInfo/BiographySection/Biography.vue create mode 100644 apps/settings/src/components/PersonalInfo/DisplayNameSection.vue delete mode 100644 apps/settings/src/components/PersonalInfo/DisplayNameSection/DisplayName.vue delete mode 100644 apps/settings/src/components/PersonalInfo/DisplayNameSection/DisplayNameSection.vue rename apps/settings/src/components/PersonalInfo/{HeadlineSection => }/HeadlineSection.vue (54%) delete mode 100644 apps/settings/src/components/PersonalInfo/HeadlineSection/Headline.vue rename apps/settings/src/components/PersonalInfo/{OrganisationSection => }/OrganisationSection.vue (53%) delete mode 100644 apps/settings/src/components/PersonalInfo/OrganisationSection/Organisation.vue rename apps/settings/src/components/PersonalInfo/{RoleSection => }/RoleSection.vue (55%) delete mode 100644 apps/settings/src/components/PersonalInfo/RoleSection/Role.vue create mode 100644 apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index fbbee7b81bb..c60f39025e8 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -135,7 +135,6 @@ class PersonalInfo implements ISettings { $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']); } - $languageParameters = $this->getLanguageMap($user); $localeParameters = $this->getLocales($user); $messageParameters = $this->getMessageParameters($account); @@ -148,12 +147,6 @@ class PersonalInfo implements ISettings { 'federationEnabled' => $federationEnabled, 'lookupServerUploadEnabled' => $lookupServerUploadEnabled, 'avatarScope' => $account->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope(), - 'displayNameChangeSupported' => $user->canChangeDisplayName(), - 'displayName' => $account->getProperty(IAccountManager::PROPERTY_DISPLAYNAME)->getValue(), - 'displayNameScope' => $account->getProperty(IAccountManager::PROPERTY_DISPLAYNAME)->getScope(), - 'email' => $account->getProperty(IAccountManager::PROPERTY_EMAIL)->getValue(), - 'emailScope' => $account->getProperty(IAccountManager::PROPERTY_EMAIL)->getScope(), - 'emailVerification' => $account->getProperty(IAccountManager::PROPERTY_EMAIL)->getVerified(), 'phone' => $account->getProperty(IAccountManager::PROPERTY_PHONE)->getValue(), 'phoneScope' => $account->getProperty(IAccountManager::PROPERTY_PHONE)->getScope(), 'address' => $account->getProperty(IAccountManager::PROPERTY_ADDRESS)->getValue(), @@ -167,7 +160,7 @@ class PersonalInfo implements ISettings { 'groups' => $this->getGroups($user), 'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(), 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(), - ] + $messageParameters + $languageParameters + $localeParameters; + ] + $messageParameters + $localeParameters; $personalInfoParameters = [ 'userId' => $uid, @@ -213,6 +206,7 @@ class PersonalInfo implements ISettings { */ private function getProperty(IAccount $account, string $property): array { $property = [ + 'name' => $account->getProperty($property)->getName(), 'value' => $account->getProperty($property)->getValue(), 'scope' => $account->getProperty($property)->getScope(), 'verified' => $account->getProperty($property)->getVerified(), @@ -262,6 +256,7 @@ class PersonalInfo implements ISettings { */ private function getEmailMap(IAccount $account): array { $systemEmail = [ + 'name' => $account->getProperty(IAccountManager::PROPERTY_EMAIL)->getName(), 'value' => $account->getProperty(IAccountManager::PROPERTY_EMAIL)->getValue(), 'scope' => $account->getProperty(IAccountManager::PROPERTY_EMAIL)->getScope(), 'verified' => $account->getProperty(IAccountManager::PROPERTY_EMAIL)->getVerified(), @@ -270,6 +265,7 @@ class PersonalInfo implements ISettings { $additionalEmails = array_map( function (IAccountProperty $property) { return [ + 'name' => $property->getName(), 'value' => $property->getValue(), 'scope' => $property->getScope(), 'verified' => $property->getVerified(), diff --git a/apps/settings/src/components/PersonalInfo/BiographySection/BiographySection.vue b/apps/settings/src/components/PersonalInfo/BiographySection.vue similarity index 54% rename from apps/settings/src/components/PersonalInfo/BiographySection/BiographySection.vue rename to apps/settings/src/components/PersonalInfo/BiographySection.vue index c8464f7b243..30c240dee1a 100644 --- a/apps/settings/src/components/PersonalInfo/BiographySection/BiographySection.vue +++ b/apps/settings/src/components/PersonalInfo/BiographySection.vue @@ -1,9 +1,9 @@ - - diff --git a/apps/settings/src/components/PersonalInfo/BiographySection/Biography.vue b/apps/settings/src/components/PersonalInfo/BiographySection/Biography.vue deleted file mode 100644 index 48c2bf4ff77..00000000000 --- a/apps/settings/src/components/PersonalInfo/BiographySection/Biography.vue +++ /dev/null @@ -1,184 +0,0 @@ - - -