Skip to content

Commit

Permalink
Merge pull request #10049 from nextcloud/enhanc/cross-link-appsettings
Browse files Browse the repository at this point in the history
Feat: cross link app settings to account settings
  • Loading branch information
GretaD authored Sep 5, 2024
2 parents 5115c32 + cb67528 commit ae12c7b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/components/AccountSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ export default {
}
},
computed: {
menu() {
return this.buildMenu()
},
displayName() {
return this.account.name
},
Expand Down
27 changes: 26 additions & 1 deletion src/components/AppSettingsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:name="t('mail', 'Mail settings')"
:show-navigation="true"
:open.sync="showSettings">
<NcAppSettingsSection id="account-settings" :name="t('mail', 'Account creation')">
<NcAppSettingsSection id="account-creation" :name="t('mail', 'Accounts')">
<NcButton v-if="allowNewMailAccounts"
type="primary"
to="/setup"
Expand All @@ -19,6 +19,18 @@
</template>
{{ t('mail', 'Add mail account') }}
</NcButton>

<h6>{{ t('mail', 'Account settings') }}</h6>
<p>{{ t('mail', 'Settings for:') }}</p>
<li v-for="account in accounts" :key="account.id">
<NcButton v-if="account && account.emailAddress"
class="app-settings-button"
type="secondary"
:aria-label="t('mail', 'Account settings')"
@click="openAccountSettings(account.id)">
{{ account.emailAddress }}
</NcButton>
</li>
</NcAppSettingsSection>

<NcAppSettingsSection id="appearance-and-accessibility" :name="t('mail', 'General')">
Expand Down Expand Up @@ -347,13 +359,19 @@ export default {
displaySmimeCertificateModal: false,
sortOrder: 'newest',
showSettings: false,
showAccountSettings: false,
showMailSettings: true,
selectedAccount: null,
mailvelopeIsAvailable: false,
}
},
computed: {
...mapGetters([
'isFollowUpFeatureAvailable',
]),
...mapGetters({
accounts: 'accounts',
}),
searchPriorityBody() {
return this.$store.getters.getPreference('search-priority-body', 'false') === 'true'
},
Expand Down Expand Up @@ -402,6 +420,13 @@ export default {
this.checkMailvelope()
},
methods: {
closeAccountSettings() {
this.showAccountSettings = false
},
openAccountSettings(accountId) {
this.$store.commit('showSettingsForAccount', accountId)
this.showSettings = false
},
checkMailvelope() {
this.mailvelopeIsAvailable = !!window.mailvelope
},
Expand Down
27 changes: 14 additions & 13 deletions src/components/NavigationAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
{{ quotaText }}
</ActionText>
<ActionButton :close-after-click="true"
@click="showAccountSettings"
@shortkey="toggleAccountSettings">
@click="showAccountSettings(true)">
<template #icon>
<IconSettings :size="16" />
</template>
Expand Down Expand Up @@ -81,7 +80,7 @@
</template>
</template>
</NcAppNavigationCaption>
<AccountSettings :open="showSettings" :account="account" @update:open="toggleAccountSettings" />
<AccountSettings :open="showSettings" :account="account" @update:open="showAccountSettings($event)" />
</Fragment>
</template>

Expand Down Expand Up @@ -150,14 +149,16 @@ export default {
quota: undefined,
editing: false,
showSaving: false,
showSettings: false,
createMailboxName: '',
showMailboxes: false,
nameInput: false,
nameLabel: true,
}
},
computed: {
showSettings() {
return this.$store.getters.showSettingsForAccount(this.account.id)
},
visible() {
return this.account.isUnified !== true && this.account.visible !== false
},
Expand Down Expand Up @@ -286,16 +287,16 @@ export default {
}
},
/**
* Toggles the account settings overview
*/
toggleAccountSettings() {
this.showSettings = !this.showSettings
},
/**
* Shows the account settings
* Show the settings for the given account
*
* @param {boolean} show true to show, false to hide
*/
showAccountSettings() {
this.showSettings = true
showAccountSettings(show) {
if (show) {
this.$store.commit('showSettingsForAccount', this.account.id)
} else {
this.$store.commit('showSettingsForAccount', null)
}
},
},
}
Expand Down
1 change: 1 addition & 0 deletions src/store/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,5 @@ export const getters = {
isFollowUpFeatureAvailable: (state) => state.followUpFeatureAvailable,
getInternalAddresses: (state) => state.internalAddress?.filter(internalAddress => internalAddress !== undefined),
hasCurrentUserPrincipalAndCollections: (state) => state.hasCurrentUserPrincipalAndCollections,
showSettingsForAccount: (state) => (accountId) => state.showAccountSettings === accountId,
}
1 change: 1 addition & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default new Store({
followUpFeatureAvailable: false,
internalAddress: [],
hasCurrentUserPrincipalAndCollections: false,
showAccountSettings: null,
},
getters,
mutations,
Expand Down
3 changes: 3 additions & 0 deletions src/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,4 +516,7 @@ export default {
hasCurrentUserPrincipalAndCollections(state, hasCurrentUserPrincipalAndCollections) {
state.hasCurrentUserPrincipalAndCollections = hasCurrentUserPrincipalAndCollections
},
showSettingsForAccount(state, accountId) {
state.showAccountSettings = accountId
},
}

0 comments on commit ae12c7b

Please sign in to comment.