Skip to content

Commit

Permalink
Feat: cross link app settings to account settings
Browse files Browse the repository at this point in the history
Signed-off-by: greta <[email protected]>
  • Loading branch information
GretaD committed Sep 5, 2024
1 parent 629a9fa commit 8cd8648
Show file tree
Hide file tree
Showing 6 changed files with 47 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
29 changes: 28 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>

Check failure on line 23 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected indentation of 4 tabs but found 3 tabs
<p>{{ t('mail', 'Settings for:') }}</p>
<li v-for="account in accounts" :key="account.id">

Check failure on line 25 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected indentation of 4 tabs but found 3 tabs
<NcButton v-if="account && account.emailAddress"

Check failure on line 26 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected indentation of 5 tabs but found 4 tabs
class="app-settings-button"

Check failure on line 27 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected "\t" character, but found " " character
type="secondary"

Check failure on line 28 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected "\t" character, but found " " character
:aria-label="t('mail', 'Account settings')"

Check failure on line 29 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected "\t" character, but found " " character
@click="openAccountSettings(account.id)">

Check failure on line 30 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected "\t" character, but found " " character
{{ account.emailAddress }}

Check failure on line 31 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected indentation of 6 tabs but found 5 tabs
</NcButton>

Check failure on line 32 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected indentation of 5 tabs but found 4 tabs
</li>

Check failure on line 33 in src/components/AppSettingsMenu.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected indentation of 4 tabs but found 3 tabs
</NcAppSettingsSection>

<NcAppSettingsSection id="appearance-and-accessibility" :name="t('mail', 'General')">
Expand Down Expand Up @@ -299,6 +311,7 @@ import Logger from '../logger.js'
import SmimeCertificateModal from './smime/SmimeCertificateModal.vue'
import TrustedSenders from './TrustedSenders.vue'
import InternalAddress from './InternalAddress.vue'
import AccountSettings from './AccountSettings.vue'
import isMobile from '@nextcloud/vue/dist/Mixins/isMobile.js'
import { mapGetters } from 'vuex'
Expand All @@ -307,6 +320,7 @@ export default {
components: {
TrustedSenders,
InternalAddress,
AccountSettings,
NcButton,
IconEmail,
IconAdd,
Expand Down Expand Up @@ -347,13 +361,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 +422,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 8cd8648

Please sign in to comment.