[GODT-354] Do not label/unlabel messsages from `All Mail` folder

This commit is contained in:
Jakub 2020-05-14 10:24:34 +02:00 committed by Jakub Cuth
parent 9808c44714
commit 49cc49b1e2
2 changed files with 35 additions and 0 deletions

View File

@ -82,6 +82,33 @@ 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.

View File

@ -24,6 +24,8 @@ import (
bolt "go.etcd.io/bbolt"
)
var errAllMailOpNotAllowed = errors.New("operation not supported for 'All Mail' folder")
// GetMessage returns the `pmapi.Message` struct wrapped in `StoreMessage`
// tied to this mailbox.
func (storeMailbox *Mailbox) GetMessage(apiID string) (*Message, error) {
@ -78,6 +80,9 @@ func (storeMailbox *Mailbox) LabelMessages(apiIDs []string) error {
"label": storeMailbox.labelID,
"mailbox": storeMailbox.Name,
}).Trace("Labeling messages")
if storeMailbox.labelID == pmapi.AllMailLabel {
return errAllMailOpNotAllowed
}
defer storeMailbox.pollNow()
return storeMailbox.client().LabelMessages(apiIDs, storeMailbox.labelID)
}
@ -91,6 +96,9 @@ func (storeMailbox *Mailbox) UnlabelMessages(apiIDs []string) error {
"label": storeMailbox.labelID,
"mailbox": storeMailbox.Name,
}).Trace("Unlabeling messages")
if storeMailbox.labelID == pmapi.AllMailLabel {
return errAllMailOpNotAllowed
}
defer storeMailbox.pollNow()
return storeMailbox.client().UnlabelMessages(apiIDs, storeMailbox.labelID)
}