diff options
author | Christopher Ng <chrng8@gmail.com> | 2021-07-16 08:46:04 +0300 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2021-07-16 08:46:04 +0300 |
commit | 74aa115125618ad67d0b83d0e34e618799bc0cc7 (patch) | |
tree | 0524f535066fa57b83d51ba9c509126dd6f36fc1 /apps/settings/src | |
parent | 6744f3c083db797e6f4dc6f47cc2d8c1aeb3a020 (diff) |
Refine unsupported federation scope checks
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/settings/src')
-rw-r--r-- | apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue | 5 | ||||
-rw-r--r-- | apps/settings/src/components/PersonalInfo/EmailSection/FederationControl.vue | 20 |
2 files changed, 21 insertions, 4 deletions
diff --git a/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue b/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue index 2bcc491323b..bcd5973f626 100644 --- a/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue +++ b/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue @@ -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: { diff --git a/apps/settings/src/components/PersonalInfo/EmailSection/FederationControl.vue b/apps/settings/src/components/PersonalInfo/EmailSection/FederationControl.vue index 87496a81160..6d48c157d6b 100644 --- a/apps/settings/src/components/PersonalInfo/EmailSection/FederationControl.vue +++ b/apps/settings/src/components/PersonalInfo/EmailSection/FederationControl.vue @@ -42,11 +42,14 @@ <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 }, |