forked from Silverfish/proton-bridge
Do not allow deleting messages from All Mail
This commit is contained in:
@ -71,6 +71,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
|||||||
* IE: Removed `onLoginFinished`
|
* IE: Removed `onLoginFinished`
|
||||||
* Structure for transfer rules in QML
|
* Structure for transfer rules in QML
|
||||||
* GODT-213 Convert panics from message parser to error.
|
* GODT-213 Convert panics from message parser to error.
|
||||||
|
* GODT-585 Do not allow deleting messages from All Mail.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* GODT-655 Fix date picker with automatic Windows DST
|
* GODT-655 Fix date picker with automatic Windows DST
|
||||||
|
|||||||
@ -57,7 +57,7 @@ func (im *imapMailbox) UpdateMessagesFlags(uid bool, seqSet *imap.SeqSet, operat
|
|||||||
return im.addOrRemoveFlags(operation, messageIDs, flags)
|
return im.addOrRemoveFlags(operation, messageIDs, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (im *imapMailbox) setFlags(messageIDs, flags []string) error {
|
func (im *imapMailbox) setFlags(messageIDs, flags []string) error { //nolint
|
||||||
seen := false
|
seen := false
|
||||||
flagged := false
|
flagged := false
|
||||||
deleted := false
|
deleted := false
|
||||||
|
|||||||
@ -180,6 +180,9 @@ func (storeMailbox *Mailbox) MarkMessagesDeleted(apiIDs []string) error {
|
|||||||
"label": storeMailbox.labelID,
|
"label": storeMailbox.labelID,
|
||||||
"mailbox": storeMailbox.Name,
|
"mailbox": storeMailbox.Name,
|
||||||
}).Trace("Marking messages as deleted")
|
}).Trace("Marking messages as deleted")
|
||||||
|
if storeMailbox.labelID == pmapi.AllMailLabel {
|
||||||
|
return ErrAllMailOpNotAllowed
|
||||||
|
}
|
||||||
return storeMailbox.store.db.Update(func(tx *bolt.Tx) error {
|
return storeMailbox.store.db.Update(func(tx *bolt.Tx) error {
|
||||||
return storeMailbox.txMarkMessagesAsDeleted(tx, apiIDs, true)
|
return storeMailbox.txMarkMessagesAsDeleted(tx, apiIDs, true)
|
||||||
})
|
})
|
||||||
@ -193,6 +196,9 @@ func (storeMailbox *Mailbox) MarkMessagesUndeleted(apiIDs []string) error {
|
|||||||
"label": storeMailbox.labelID,
|
"label": storeMailbox.labelID,
|
||||||
"mailbox": storeMailbox.Name,
|
"mailbox": storeMailbox.Name,
|
||||||
}).Trace("Marking messages as undeleted")
|
}).Trace("Marking messages as undeleted")
|
||||||
|
if storeMailbox.labelID == pmapi.AllMailLabel {
|
||||||
|
return ErrAllMailOpNotAllowed
|
||||||
|
}
|
||||||
return storeMailbox.store.db.Update(func(tx *bolt.Tx) error {
|
return storeMailbox.store.db.Update(func(tx *bolt.Tx) error {
|
||||||
return storeMailbox.txMarkMessagesAsDeleted(tx, apiIDs, false)
|
return storeMailbox.txMarkMessagesAsDeleted(tx, apiIDs, false)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -93,3 +93,9 @@ Feature: IMAP remove messages from mailbox
|
|||||||
| LOGOUT | 9 |
|
| LOGOUT | 9 |
|
||||||
| UNSELECT | 10 |
|
| UNSELECT | 10 |
|
||||||
|
|
||||||
|
Scenario: Not possible to delete from All Mail
|
||||||
|
Given there are 1 messages in mailbox "All Mail" for "user"
|
||||||
|
And there is IMAP client logged in as "user"
|
||||||
|
And there is IMAP client selected in "All Mail"
|
||||||
|
When IMAP client marks message "1" as deleted
|
||||||
|
Then IMAP response is "IMAP error: NO operation not allowed for 'All Mail' folder"
|
||||||
|
|||||||
Reference in New Issue
Block a user