Completely delete old draft instead moving to trash when user updates draft

This commit is contained in:
Michal Horejsek 2020-04-09 09:59:38 +02:00 committed by Jakub Cuth
parent e962434c8f
commit 0c7a328165
2 changed files with 6 additions and 1 deletions

View File

@ -11,6 +11,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
### Changed
* GODT-225 Do not send an EXISTS reposnse after EXPUNGE or when nothing changed (fixes rebuild of mailboxes in Outlook for Mac)
* GODT-165 Optimization of RebuildMailboxes
* GODT-282 Completely delete old draft instead moving to trash when user updates draft
* Adding DSN Sentry as build time parameter
* GODT-124 bump go-appdir from v1.0.0 to v1.1.0

View File

@ -206,6 +206,10 @@ func (storeMailbox *Mailbox) DeleteMessages(apiIDs []string) error {
return err
}
}
case pmapi.DraftLabel:
if err := storeMailbox.api().DeleteMessages(apiIDs); err != nil {
return err
}
default:
if err := storeMailbox.api().UnlabelMessages(apiIDs, storeMailbox.labelID); err != nil {
return err
@ -266,7 +270,7 @@ func (storeMailbox *Mailbox) txCreateOrUpdateMessages(tx *bolt.Tx, msgs []*pmapi
// Draft bodies can change and bodies are not re-fetched by IMAP clients.
// Every change has to be a new message; we need to delete the old one and always recreate it.
if storeMailbox.labelID == pmapi.DraftLabel {
if msg.Type == pmapi.MessageTypeDraft {
if err := storeMailbox.txDeleteMessage(tx, msg.ID); err != nil {
return errors.Wrap(err, "cannot delete old draft")
}