Skip to content
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
61 changes: 42 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@nextcloud/paths": "^2.2.1",
"@nextcloud/router": "^3.0.1",
"@nextcloud/vue": "^8.20.0",
"@pinia/testing": "^0.1.6",
"@riophae/vue-treeselect": "^0.4.0",
"@vue/babel-preset-app": "^5.0.8",
"address-rfc2822": "^2.2.2",
Expand Down Expand Up @@ -87,8 +88,6 @@
"vue-scroll": "^2.1.13",
"vue-shortkey": "^3.1.7",
"vue-tabs-component": "^1.5.0",
"vuex": "^3.6.2",
"vuex-router-sync": "^5.0.0",
"webdav": "4.11.4"
},
"browserslist": [
Expand Down
18 changes: 11 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,25 @@
</template>

<script>
import { mapGetters } from 'vuex'
import { showError } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'

import logger from './logger.js'
import { matchError } from './errors/match.js'
import MailboxLockedError from './errors/MailboxLockedError.js'
import { mapStores, mapState } from 'pinia'
import useMainStore from './store/mainStore.js'
import initAfterAppCreation from './init.js'

export default {
name: 'App',
computed: {
...mapGetters([
...mapStores(useMainStore),
...mapState(useMainStore, [
'isExpiredSession',
]),
hasMailAccounts() {
return !!this.$store.getters.accounts.find((account) => !account.isUnified)
return !!this.mainStore.getAccounts.find((account) => !account.isUnified)
},
},
watch: {
Expand All @@ -38,6 +41,7 @@ export default {
},
},
async mounted() {
initAfterAppCreation()
// Redirect to setup page if no accounts are configured
if (!this.hasMailAccounts) {
this.$router.replace({
Expand All @@ -46,9 +50,9 @@ export default {
}

this.sync()
await this.$store.dispatch('fetchCurrentUserPrincipal')
await this.$store.dispatch('loadCollections')
this.$store.commit('hasCurrentUserPrincipalAndCollections', true)
await this.mainStore.fetchCurrentUserPrincipal()
await this.mainStore.loadCollections()
this.mainStore.hasCurrentUserPrincipalAndCollectionsMutation(true)
},
methods: {
reload() {
Expand All @@ -57,7 +61,7 @@ export default {
sync() {
setTimeout(async () => {
try {
await this.$store.dispatch('syncInboxes')
await this.mainStore.syncInboxes()

logger.debug("Inboxes sync'ed in background")
} catch (error) {
Expand Down
27 changes: 15 additions & 12 deletions src/components/AccountDefaultsSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<script>
import logger from '../logger.js'
import MailboxInlinePicker from './MailboxInlinePicker.vue'
import { mapStores } from 'pinia'
import useMainStore from '../store/mainStore.js'

export default {
name: 'AccountDefaultsSettings',
Expand All @@ -59,9 +61,10 @@ export default {
}
},
computed: {
...mapStores(useMainStore),
draftsMailbox: {
get() {
const mb = this.$store.getters.getMailbox(this.account.draftsMailboxId)
const mb = this.mainStore.getMailbox(this.account.draftsMailboxId)
if (!mb) {
return
}
Expand All @@ -71,7 +74,7 @@ export default {
logger.debug('setting drafts mailbox to ' + draftsMailboxId)
this.saving = true
try {
await this.$store.dispatch('patchAccount', {
await this.mainStore.patchAccount({
account: this.account,
data: {
draftsMailboxId,
Expand All @@ -88,7 +91,7 @@ export default {
},
sentMailbox: {
get() {
const mb = this.$store.getters.getMailbox(this.account.sentMailboxId)
const mb = this.mainStore.getMailbox(this.account.sentMailboxId)
if (!mb) {
return
}
Expand All @@ -98,7 +101,7 @@ export default {
logger.debug('setting sent mailbox to ' + sentMailboxId)
this.saving = true
try {
await this.$store.dispatch('patchAccount', {
await this.mainStore.patchAccount({
account: this.account,
data: {
sentMailboxId,
Expand All @@ -115,7 +118,7 @@ export default {
},
trashMailbox: {
get() {
const mb = this.$store.getters.getMailbox(this.account.trashMailboxId)
const mb = this.mainStore.getMailbox(this.account.trashMailboxId)
if (!mb) {
return
}
Expand All @@ -125,7 +128,7 @@ export default {
logger.debug('setting trash mailbox to ' + trashMailboxId)
this.saving = true
try {
await this.$store.dispatch('patchAccount', {
await this.mainStore.patchAccount({
account: this.account,
data: {
trashMailboxId,
Expand All @@ -142,7 +145,7 @@ export default {
},
archiveMailbox: {
get() {
const mb = this.$store.getters.getMailbox(this.account.archiveMailboxId)
const mb = this.mainStore.getMailbox(this.account.archiveMailboxId)
if (!mb) {
return
}
Expand All @@ -152,7 +155,7 @@ export default {
logger.debug('setting archive mailbox to ' + archiveMailboxId)
this.saving = true
try {
await this.$store.dispatch('patchAccount', {
await this.mainStore.patchAccount({
account: this.account,
data: {
archiveMailboxId,
Expand All @@ -169,7 +172,7 @@ export default {
},
junkMailbox: {
get() {
const mb = this.$store.getters.getMailbox(this.account.junkMailboxId)
const mb = this.mainStore.getMailbox(this.account.junkMailboxId)
if (!mb) {
return
}
Expand All @@ -179,7 +182,7 @@ export default {
logger.debug('setting junk mailbox to ' + junkMailboxId)
this.saving = true
try {
await this.$store.dispatch('patchAccount', {
await this.mainStore.patchAccount({
account: this.account,
data: {
junkMailboxId,
Expand All @@ -196,7 +199,7 @@ export default {
},
snoozeMailbox: {
get() {
const mb = this.$store.getters.getMailbox(this.account.snoozeMailboxId)
const mb = this.mainStore.getMailbox(this.account.snoozeMailboxId)
if (!mb) {
return
}
Expand All @@ -206,7 +209,7 @@ export default {
logger.debug('setting snooze mailbox to ' + snoozeMailboxId)
this.saving = true
try {
await this.$store.dispatch('patchAccount', {
await this.mainStore.patchAccount({
account: this.account,
data: {
snoozeMailboxId,
Expand Down
16 changes: 9 additions & 7 deletions src/components/AccountForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@

<script>
import { Tab, Tabs } from 'vue-tabs-component'
import { mapGetters } from 'vuex'
import { NcButton as ButtonVue, NcLoadingIcon as IconLoading, NcPasswordField, NcInputField, NcCheckboxRadioSwitch } from '@nextcloud/vue'
import IconCheck from 'vue-material-design-icons/Check.vue'
import { translate as t } from '@nextcloud/l10n'
Expand All @@ -251,6 +250,8 @@ import {
testConnectivity,
} from '../service/AutoConfigService.js'
import { CONSENT_ABORTED, getUserConsent } from '../integration/oauth.js'
import useMainStore from '../store/mainStore.js'
import { mapStores, mapState } from 'pinia'

export default {
name: 'AccountForm',
Expand Down Expand Up @@ -314,7 +315,8 @@ export default {
}
},
computed: {
...mapGetters([
...mapStores(useMainStore),
...mapState(useMainStore, [
'googleOauthUrl',
'microsoftOauthUrl',
]),
Expand Down Expand Up @@ -563,7 +565,7 @@ export default {
delete data.smtpPassword
}
if (!this.account) {
const account = await this.$store.dispatch('startAccountSetup', data)
const account = await this.mainStore.startAccountSetup(data)
if (this.useOauth) {
this.loadingMessage = t('mail', 'Awaiting user consent')
try {
Expand All @@ -584,18 +586,18 @@ export default {
}
} catch (e) {
// Clean up the temporary account before we continue
this.$store.dispatch('deleteAccount', account)
this.mainStore.deleteAccount(account)
logger.info(`Temporary account ${account.id} deleted`)
throw e
}
this.clearFeedback()
}
this.loadingMessage = t('mail', 'Loading account')
await this.$store.dispatch('finishAccountSetup', { account })
await this.mainStore.finishAccountSetup({ account })
this.$emit('account-created', account)
} else {
const oldAccountData = this.account
const account = await this.$store.dispatch('updateAccount', {
const account = await this.mainStore.updateAccount({
...data,
accountId: this.account.id,
})
Expand All @@ -619,7 +621,7 @@ export default {
}
} catch (e) {
// Undo changes
await this.$store.dispatch('updateAccount', {
await this.mainStore.updateAccount({
...oldAccountData,
accountId: oldAccountData.id,
})
Expand Down
5 changes: 4 additions & 1 deletion src/components/AccountSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ import SearchSettings from './SearchSettings.vue'
import TrashRetentionSettings from './TrashRetentionSettings.vue'
import logger from '../logger.js'
import MailFilters from './mailFilter/MailFilters.vue'
import useMainStore from '../store/mainStore.js'
import { mapStores } from 'pinia'

export default {
name: 'AccountSettings',
Expand Down Expand Up @@ -148,6 +150,7 @@ export default {
}
},
computed: {
...mapStores(useMainStore),
displayName() {
return this.account.name
},
Expand All @@ -160,7 +163,7 @@ export default {
if (newState === true && this.fetchActiveSieveScript === true) {
logger.debug(`Load active sieve script for account ${this.account.accountId}`)
this.fetchActiveSieveScript = false
this.$store.dispatch('fetchActiveSieveScript', {
this.mainStore.fetchActiveSieveScript({
accountId: this.account.id,
})
}
Expand Down
Loading
Loading