]> source.dussan.org Git - nextcloud-server.git/commitdiff
Refine unsupported federation scope checks
authorChristopher Ng <chrng8@gmail.com>
Fri, 16 Jul 2021 05:46:04 +0000 (05:46 +0000)
committerChristopher Ng <chrng8@gmail.com>
Fri, 16 Jul 2021 05:46:04 +0000 (05:46 +0000)
Signed-off-by: Christopher Ng <chrng8@gmail.com>
apps/settings/lib/Settings/Personal/PersonalInfo.php
apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue
apps/settings/src/components/PersonalInfo/EmailSection/FederationControl.vue

index 656f949a4af16442d08f6d7b0bdec25c1983a8f7..387843c552258714a8fb816372d14afaf69cd87e 100644 (file)
@@ -149,6 +149,7 @@ class PersonalInfo implements ISettings {
 
                $accountParameters = [
                        'displayNameChangeSupported' => $user->canChangeDisplayName(),
+                       'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
                ];
 
                $this->initialStateService->provideInitialState('emails', $emails);
index 2bcc491323b58df58c7e40fc5c23a367113a2c1c..bcd5973f626f3c26336dd184e1b1d04ff22f0147 100644 (file)
@@ -62,7 +62,7 @@ import { savePrimaryEmail, removeAdditionalEmail } from '../../../service/Person
 import { DEFAULT_ADDITIONAL_EMAIL_SCOPE } from '../../../constants/AccountPropertyConstants'
 
 const { additionalEmails, primaryEmail } = loadState('settings', 'emails', {})
-const accountParams = loadState('settings', 'accountParameters', {})
+const { displayNameChangeSupported } = loadState('settings', 'accountParameters', {})
 
 export default {
        name: 'EmailSection',
@@ -74,7 +74,6 @@ export default {
 
        data() {
                return {
-                       accountParams,
                        additionalEmails,
                        primaryEmail,
                        isValidForm: true,
@@ -83,7 +82,7 @@ export default {
 
        computed: {
                isDisplayNameChangeSupported() {
-                       return this.accountParams.displayNameChangeSupported
+                       return displayNameChangeSupported
                },
 
                primaryEmailValue: {
index 87496a81160c8ea695c2c76723ed4062b142adb2..6d48c157d6bdd17486a15872b0ac32e54c6e61e9 100644 (file)
 <script>
 import Actions from '@nextcloud/vue/dist/Components/Actions'
 import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
+import { loadState } from '@nextcloud/initial-state'
 import { showError } from '@nextcloud/dialogs'
 
 import { SCOPE_ENUM, SCOPE_PROPERTY_ENUM } from '../../../constants/AccountPropertyConstants'
 import { savePrimaryEmailScope, saveAdditionalEmailScope } from '../../../service/PersonalInfoService'
 
+const { lookupServerUploadEnabled } = loadState('settings', 'accountParameters', {})
+
 // TODO hardcoded for email, should abstract this for other sections
 const excludedScopes = [SCOPE_ENUM.PRIVATE]
 
@@ -80,11 +83,26 @@ export default {
        data() {
                return {
                        initialScope: this.scope,
-                       federationScopes: Object.values(SCOPE_PROPERTY_ENUM).filter(({ name }) => !excludedScopes.includes(name)),
                }
        },
 
        computed: {
+               federationScopes() {
+                       return Object.values(SCOPE_PROPERTY_ENUM).filter(({ name }) => !this.unsupportedScopes.includes(name))
+               },
+
+               unsupportedScopes() {
+                       if (!lookupServerUploadEnabled) {
+                               return [
+                                       ...excludedScopes,
+                                       SCOPE_ENUM.FEDERATED,
+                                       SCOPE_ENUM.PUBLISHED,
+                               ]
+                       }
+
+                       return excludedScopes
+               },
+
                scopeIcon() {
                        return SCOPE_PROPERTY_ENUM[this.scope].iconClass
                },