diff --git a/src/components/NavigationMailbox.vue b/src/components/NavigationMailbox.vue index b858c35cb4..6ef366624b 100644 --- a/src/components/NavigationMailbox.vue +++ b/src/components/NavigationMailbox.vue @@ -111,7 +111,7 @@ - + @@ -353,15 +359,17 @@ export default { mailboxStats: undefined, loadingMarkAsRead: false, clearingCache: false, - showSaving: false, changeSubscription: false, changingSyncInBackground: false, - editing: false, + subfolderLabel: true, + subfolderInput: false, + subfolderSaving: false, showSubMailboxes: false, wasExpandedBeforeDrag: false, menuOpen: false, renameLabel: true, renameInput: false, + renameSaving: false, mailboxName: this.mailbox.displayName, showMoveModal: false, hasDelimiter: !!this.mailbox.delimiter, @@ -543,6 +551,16 @@ export default { onMenuToggle(open) { if (open) { this.fetchMailboxStats() + } else { + if (!this.renameSaving) { + this.renameLabel = true + this.renameInput = false + } + + if (!this.subfolderSaving) { + this.subfolderLabel = true + this.subfolderInput = false + } } }, @@ -566,11 +584,12 @@ export default { }, async createMailbox(e) { - this.editing = true + this.subfolderInput = false + this.subfolderSaving = true const name = this.createMailboxName const withPrefix = this.mailbox.name + this.mailbox.delimiter + name logger.info(`creating mailbox ${withPrefix} as submailbox of ${this.mailbox.databaseId}`) - this.menuOpen = false + try { await this.mainStore.createMailbox({ account: this.account, @@ -580,16 +599,20 @@ export default { logger.error(`could not create mailbox ${withPrefix}`, { error }) throw error } finally { - this.editing = false - this.showSaving = false + this.menuOpen = false + this.subfolderLabel = true + this.subfolderSaving = false } + logger.info(`mailbox ${withPrefix} created`) this.showSubMailboxes = true }, openCreateMailbox() { - this.editing = true - this.showSaving = false + this.subfolderLabel = false + this.createMailboxName = '' + this.subfolderInput = true + this.subfolderSaving = false }, markAsRead() { @@ -712,7 +735,7 @@ export default { async renameMailbox() { this.renameInput = false - this.showSaving = true + this.renameSaving = true try { let newName = this.mailboxName @@ -724,21 +747,21 @@ export default { mailbox: this.mailbox, newName, }) - this.renameLabel = true - this.renameInput = false } catch (error) { showInfo(t('mail', 'An error occurred, unable to rename the mailbox.')) logger.error('could not rename mailbox', { error }) } finally { - this.showSaving = false + this.renameSaving = false + this.renameLabel = true } }, openRenameInput() { // Hide label and show input this.renameLabel = false + this.mailboxName = this.mailbox.displayName this.renameInput = true - this.showSaving = false + this.renameSaving = false }, onOpenMoveModal() {