Skip to content

Commit

Permalink
Merge pull request #10069 from nextcloud/fix/add-mailbox
Browse files Browse the repository at this point in the history
fix: creating mailbox doesnt reset after saving
  • Loading branch information
GretaD authored Aug 29, 2024
2 parents 18f6d12 + e7da6c7 commit 62f1cec
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions src/components/NavigationAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
@update:checked="changeShowSubscribedOnly">
{{ t('mail', 'Show only subscribed mailboxes') }}
</ActionCheckbox>
<ActionButton v-if="!editing" @click="openCreateMailbox">
<ActionButton v-if="!editing && nameLabel" @click="openCreateMailbox">
<template #icon>
<IconFolderAdd :size="16" />
</template>
{{ t('mail', 'Add mailbox') }}
</ActionButton>
<ActionInput v-if="editing"
<ActionInput v-if="editing && nameInput"
:value.sync="createMailboxName"
@submit.prevent.stop="createMailbox">
<template #icon>
Expand Down Expand Up @@ -152,6 +152,9 @@ export default {
showSaving: false,
showSettings: false,
createMailboxName: '',
showMailboxes: false,
nameInput: false,
nameLabel: true,
}
},
computed: {
Expand All @@ -176,23 +179,30 @@ export default {
},
},
methods: {
createMailbox(e) {
this.editing = true
async createMailbox(e) {
this.nameInput = false
this.showSaving = true
const name = this.createMailboxName
logger.info('creating mailbox ' + name)
this.menuOpen = false
this.$store
.dispatch('createMailbox', { account: this.account, name })
.then(() => logger.info(`mailbox ${name} created`))
.catch((error) => {
logger.error('could not create mailbox', { error })
throw error
try {
await this.$store.dispatch('createMailbox', {
account: this.account, name,
})
this.editing = false
this.showSaving = false
} catch (error) {
logger.error('could not create mailbox', { error })
throw error
} finally {
this.showSaving = false
this.nameInput = false
this.editing = false
this.createMailboxName = ''
}
logger.info(`mailbox ${name} created`)
},
openCreateMailbox() {
this.editing = true
this.nameInput = true
this.showSaving = false
},
async removeAccount() {
Expand Down

0 comments on commit 62f1cec

Please sign in to comment.