From fbca5e9ad6a323d215297dbe46c7239a603333c0 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 +--- .../PersonalInfo/DisplayNameSection.vue | 62 ++++++ .../DisplayNameSection/DisplayName.vue | 180 ------------------ .../DisplayNameSection/DisplayNameSection.vue | 86 --------- .../PersonalInfo/EmailSection/Email.vue | 14 +- .../EmailSection/EmailSection.vue | 18 +- .../{HeadlineSection => }/HeadlineSection.vue | 37 +--- .../PersonalInfo/HeadlineSection/Headline.vue | 175 ----------------- .../PersonalInfo/LanguageSection/Language.vue | 8 +- .../LanguageSection/LanguageSection.vue | 12 +- .../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 ----------------- .../AccountPropertyInput.vue} | 154 ++++++++++----- .../shared/AccountPropertySection.vue | 91 +++++++++ .../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, 418 insertions(+), 1060 deletions(-) rename apps/settings/src/components/PersonalInfo/{BiographySection => }/BiographySection.vue (54%) 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 rename apps/settings/src/components/PersonalInfo/{BiographySection/Biography.vue => shared/AccountPropertyInput.vue} (50%) 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 fbbee7b81bbba..c60f39025e809 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -135,7 +135,6 @@ public function getForm(): TemplateResponse { $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']); } - $languageParameters = $this->getLanguageMap($user); $localeParameters = $this->getLocales($user); $messageParameters = $this->getMessageParameters($account); @@ -148,12 +147,6 @@ public function getForm(): TemplateResponse { '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 @@ public function getForm(): TemplateResponse { 'groups' => $this->getGroups($user), 'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(), 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(), - ] + $messageParameters + $languageParameters + $localeParameters; + ] + $messageParameters + $localeParameters; $personalInfoParameters = [ 'userId' => $uid, @@ -213,6 +206,7 @@ private function isFairUseOfFreePushService(): bool { */ 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 @@ static function (IGroup $group) { */ 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 @@ private function getEmailMap(IAccount $account): array { $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 c8464f7b243f5..d85631b356355 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/DisplayNameSection.vue b/apps/settings/src/components/PersonalInfo/DisplayNameSection.vue new file mode 100644 index 0000000000000..e4e9e4441d54b --- /dev/null +++ b/apps/settings/src/components/PersonalInfo/DisplayNameSection.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/apps/settings/src/components/PersonalInfo/DisplayNameSection/DisplayName.vue b/apps/settings/src/components/PersonalInfo/DisplayNameSection/DisplayName.vue deleted file mode 100644 index 58252bfbd63ec..0000000000000 --- a/apps/settings/src/components/PersonalInfo/DisplayNameSection/DisplayName.vue +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - diff --git a/apps/settings/src/components/PersonalInfo/DisplayNameSection/DisplayNameSection.vue b/apps/settings/src/components/PersonalInfo/DisplayNameSection/DisplayNameSection.vue deleted file mode 100644 index d808369e9fb8a..0000000000000 --- a/apps/settings/src/components/PersonalInfo/DisplayNameSection/DisplayNameSection.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - diff --git a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue index 975da4327ee27..b3d25b381c221 100644 --- a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue +++ b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue @@ -40,7 +40,7 @@