Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable22] Only display supported email scopes #28014

Merged
merged 2 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions apps/settings/js/vue-settings-admin-security.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-admin-security.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions apps/settings/js/vue-settings-apps-users-management.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-apps-users-management.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/settings/js/vue-settings-nextcloud-pdf.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-nextcloud-pdf.js.map

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions apps/settings/js/vue-settings-personal-info.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-personal-info.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions apps/settings/js/vue-settings-personal-security.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-personal-security.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions apps/settings/js/vue-settings-personal-webauthn.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-personal-webauthn.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apps/settings/lib/Settings/Personal/PersonalInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public function getForm(): TemplateResponse {

$accountParameters = [
'displayNameChangeSupported' => $user->canChangeDisplayName(),
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
];

$this->initialStateService->provideInitialState('emails', $emails);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -74,7 +74,6 @@ export default {

data() {
return {
accountParams,
additionalEmails,
primaryEmail,
isValidForm: true,
Expand All @@ -83,7 +82,7 @@ export default {

computed: {
isDisplayNameChangeSupported() {
return this.accountParams.displayNameChangeSupported
return displayNameChangeSupported
},

primaryEmailValue: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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
},
Expand Down