From de16f6f2d1a01a1ea1f403e2ea697036e8d3c2aa Mon Sep 17 00:00:00 2001 From: Jakub Cuth Date: Fri, 5 Jun 2020 10:11:33 +0000 Subject: [PATCH] Apply suggestion to internal/store/mailbox_message.go --- Changelog.md | 28 +--------------------------- internal/store/mailbox_message.go | 7 ++++++- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/Changelog.md b/Changelog.md index 4f4ab430..e3583188 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/) * GODT-360 Detect charset embedded in html/xml. ### Changed +* GODT-354 Do not label/unlabel messsages from `All Mail` folder * GODT-388 Support for both bridge and import/export credentials by package users. * GODT-387 Store factory to make store optional. * GODT-386 Renamed bridge to general users and keep bridge only for bridge stuff. @@ -82,33 +83,6 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/) * Adding DSN Sentry as build time parameter. * GODT-124 Bump go-appdir from v1.0.0 to v1.1.0. * CSB-72 Skip processing message update event if http statuscode is 422. -* GODT-354 Do not label/unlabel messsages from `All Mail` folder -* GODT-162 User Agent does not contain bridge version, only client in format `client name/client version (os)` -* GODT-258 Update go-imap to v1 - * Fix UNSEEN to return sequence number of first unseen message and not count of unseen messages - * INBOX name is never quoted -* GODT-313 Reduce number of synchronizations - * do not trigger sync by counts - * cooldown timer for sync retries - * poll interval randomization -* 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 -* CSB-72 Skip processing message update event if http statuscode is 422 -* GODT-204 `ClientManager` - * `Client` is now an interface; `client` is the concrete type - * `Client`s are only created by `ClientManager` - * Only one `Client` per userID exists at any given time; clients are reused - * Tokens are managed by `ClientManager` (`TokenManager` is removed) - * `expiresAt` is no longer part of `Client`; token expiry and refreshing is handled by `ClientManager` - * Auths generated by clients during Auth/AuthRefresh are handled by `ClientManager` (which forwards them to `Bridge`) - * `ClientManager` is the "one source of truth" for the host URL for all `Client`s - * Alternative Routing is enabled/disabled by `ClientManager` - * Logging out of `Clients` is handled/retried asynchronously by `ClientManager` -* GODT-265 Alternative Routing v2 (more resiliant to short term connection drops) -* GODT-310 Alternative parsing of `References` header (old parsing probably malformed message IDs) ### Fixed * Use correct binary name when finding location of addcert.scpt. diff --git a/internal/store/mailbox_message.go b/internal/store/mailbox_message.go index 7162493b..15fd45c0 100644 --- a/internal/store/mailbox_message.go +++ b/internal/store/mailbox_message.go @@ -80,6 +80,11 @@ func (storeMailbox *Mailbox) LabelMessages(apiIDs []string) error { "label": storeMailbox.labelID, "mailbox": storeMailbox.Name, }).Trace("Labeling messages") + // Edge case is want to untrash message by drag&drop to AllMail (to not + // have it in trash but to not delete message forever). IMAP move would + // work okay but some clients might use COPY&EXPUNGE or APPEND&EXPUNGE. + // In this case COPY or APPEND is noop because the message is already + // in All mail. The consequent EXPUNGE would delete message forever. if storeMailbox.labelID == pmapi.AllMailLabel { return ErrAllMailOpNotAllowed } @@ -97,7 +102,7 @@ func (storeMailbox *Mailbox) UnlabelMessages(apiIDs []string) error { "mailbox": storeMailbox.Name, }).Trace("Unlabeling messages") if storeMailbox.labelID == pmapi.AllMailLabel { - return errAllMailOpNotAllowed + return ErrAllMailOpNotAllowed } defer storeMailbox.pollNow() return storeMailbox.client().UnlabelMessages(apiIDs, storeMailbox.labelID)