Skip to content

Commit 74aa115

Browse files
committed
Refine unsupported federation scope checks
Signed-off-by: Christopher Ng <chrng8@gmail.com>
1 parent 6744f3c commit 74aa115

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

apps/settings/lib/Settings/Personal/PersonalInfo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public function getForm(): TemplateResponse {
149149

150150
$accountParameters = [
151151
'displayNameChangeSupported' => $user->canChangeDisplayName(),
152+
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
152153
];
153154

154155
$this->initialStateService->provideInitialState('emails', $emails);

apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import { savePrimaryEmail, removeAdditionalEmail } from '../../../service/Person
6262
import { DEFAULT_ADDITIONAL_EMAIL_SCOPE } from '../../../constants/AccountPropertyConstants'
6363
6464
const { additionalEmails, primaryEmail } = loadState('settings', 'emails', {})
65-
const accountParams = loadState('settings', 'accountParameters', {})
65+
const { displayNameChangeSupported } = loadState('settings', 'accountParameters', {})
6666
6767
export default {
6868
name: 'EmailSection',
@@ -74,7 +74,6 @@ export default {
7474
7575
data() {
7676
return {
77-
accountParams,
7877
additionalEmails,
7978
primaryEmail,
8079
isValidForm: true,
@@ -83,7 +82,7 @@ export default {
8382
8483
computed: {
8584
isDisplayNameChangeSupported() {
86-
return this.accountParams.displayNameChangeSupported
85+
return displayNameChangeSupported
8786
},
8887
8988
primaryEmailValue: {

apps/settings/src/components/PersonalInfo/EmailSection/FederationControl.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@
4242
<script>
4343
import Actions from '@nextcloud/vue/dist/Components/Actions'
4444
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
45+
import { loadState } from '@nextcloud/initial-state'
4546
import { showError } from '@nextcloud/dialogs'
4647
4748
import { SCOPE_ENUM, SCOPE_PROPERTY_ENUM } from '../../../constants/AccountPropertyConstants'
4849
import { savePrimaryEmailScope, saveAdditionalEmailScope } from '../../../service/PersonalInfoService'
4950
51+
const { lookupServerUploadEnabled } = loadState('settings', 'accountParameters', {})
52+
5053
// TODO hardcoded for email, should abstract this for other sections
5154
const excludedScopes = [SCOPE_ENUM.PRIVATE]
5255
@@ -80,11 +83,26 @@ export default {
8083
data() {
8184
return {
8285
initialScope: this.scope,
83-
federationScopes: Object.values(SCOPE_PROPERTY_ENUM).filter(({ name }) => !excludedScopes.includes(name)),
8486
}
8587
},
8688
8789
computed: {
90+
federationScopes() {
91+
return Object.values(SCOPE_PROPERTY_ENUM).filter(({ name }) => !this.unsupportedScopes.includes(name))
92+
},
93+
94+
unsupportedScopes() {
95+
if (!lookupServerUploadEnabled) {
96+
return [
97+
...excludedScopes,
98+
SCOPE_ENUM.FEDERATED,
99+
SCOPE_ENUM.PUBLISHED,
100+
]
101+
}
102+
103+
return excludedScopes
104+
},
105+
88106
scopeIcon() {
89107
return SCOPE_PROPERTY_ENUM[this.scope].iconClass
90108
},

0 commit comments

Comments
 (0)