Other: Disable perma-delete for expunge on Spam folder

This commit is contained in:
Leander Beernaert
2022-12-02 13:43:08 +01:00
parent 83a569b366
commit 618cb27ac1
2 changed files with 13 additions and 23 deletions

View File

@ -326,7 +326,7 @@ func (conn *imapConnector) RemoveMessagesFromMailbox(ctx context.Context, messag
return err return err
} }
if mailboxID == proton.SpamLabel || mailboxID == proton.TrashLabel || mailboxID == proton.DraftsLabel { if mailboxID == proton.TrashLabel || mailboxID == proton.DraftsLabel {
var metadata []proton.MessageMetadata var metadata []proton.MessageMetadata
// There's currently no limit on how many IDs we can filter on, // There's currently no limit on how many IDs we can filter on,

View File

@ -6,8 +6,8 @@ Feature: IMAP remove messages from Trash
| mbox | folder | | mbox | folder |
| label | label | | label | label |
Scenario Outline: Message in Trash or Spam and some other label is not permanently deleted Scenario Outline: Message in Trash and some other label is not permanently deleted
Given the address "user@pm.me" of account "user@pm.me" has the following messages in "<mailbox>": Given the address "user@pm.me" of account "user@pm.me" has the following messages in "Trash":
| from | to | subject | body | | from | to | subject | body |
| john.doe@mail.com | user@pm.me | foo | hello | | john.doe@mail.com | user@pm.me | foo | hello |
| jane.doe@mail.com | name@pm.me | bar | world | | jane.doe@mail.com | name@pm.me | bar | world |
@ -15,27 +15,22 @@ Feature: IMAP remove messages from Trash
And the user logs in with username "user@pm.me" and password "password" And the user logs in with username "user@pm.me" and password "password"
And user "user@pm.me" finishes syncing And user "user@pm.me" finishes syncing
And user "user@pm.me" connects and authenticates IMAP client "1" And user "user@pm.me" connects and authenticates IMAP client "1"
And IMAP client "1" selects "<mailbox>" And IMAP client "1" selects "Trash"
When IMAP client "1" copies the message with subject "foo" from "<mailbox>" to "Labels/label" When IMAP client "1" copies the message with subject "foo" from "Trash" to "Labels/label"
Then it succeeds Then it succeeds
When IMAP client "1" marks the message with subject "foo" as deleted When IMAP client "1" marks the message with subject "foo" as deleted
Then it succeeds Then it succeeds
And IMAP client "1" sees 2 messages in "<mailbox>" And IMAP client "1" sees 2 messages in "Trash"
And IMAP client "1" sees 2 messages in "All Mail" And IMAP client "1" sees 2 messages in "All Mail"
And IMAP client "1" sees 1 messages in "Labels/label" And IMAP client "1" sees 1 messages in "Labels/label"
When IMAP client "1" expunges When IMAP client "1" expunges
Then it succeeds Then it succeeds
And IMAP client "1" sees 1 messages in "<mailbox>" And IMAP client "1" sees 1 messages in "Trash"
And IMAP client "1" sees 2 messages in "All Mail" And IMAP client "1" sees 2 messages in "All Mail"
And IMAP client "1" sees 1 messages in "Labels/label" And IMAP client "1" sees 1 messages in "Labels/label"
Examples: Scenario Outline: Message in Trash only is permanently deleted
| mailbox | Given the address "user@pm.me" of account "user@pm.me" has the following messages in "Trash":
| Spam |
| Trash |
Scenario Outline: Message in Trash or Spam only is permanently deleted
Given the address "user@pm.me" of account "user@pm.me" has the following messages in "<mailbox>":
| from | to | subject | body | | from | to | subject | body |
| john.doe@mail.com | user@pm.me | foo | hello | | john.doe@mail.com | user@pm.me | foo | hello |
| jane.doe@mail.com | name@pm.me | bar | world | | jane.doe@mail.com | name@pm.me | bar | world |
@ -43,17 +38,12 @@ Feature: IMAP remove messages from Trash
And the user logs in with username "user@pm.me" and password "password" And the user logs in with username "user@pm.me" and password "password"
And user "user@pm.me" finishes syncing And user "user@pm.me" finishes syncing
And user "user@pm.me" connects and authenticates IMAP client "1" And user "user@pm.me" connects and authenticates IMAP client "1"
And IMAP client "1" selects "<mailbox>" And IMAP client "1" selects "Trash"
When IMAP client "1" marks the message with subject "foo" as deleted When IMAP client "1" marks the message with subject "foo" as deleted
Then it succeeds Then it succeeds
And IMAP client "1" sees 2 messages in "<mailbox>" And IMAP client "1" sees 2 messages in "Trash"
And IMAP client "1" sees 2 messages in "All Mail" And IMAP client "1" sees 2 messages in "All Mail"
When IMAP client "1" expunges When IMAP client "1" expunges
Then it succeeds Then it succeeds
And IMAP client "1" sees 1 messages in "<mailbox>" And IMAP client "1" sees 1 messages in "Trash"
And IMAP client "1" eventually sees 1 messages in "All Mail" And IMAP client "1" eventually sees 1 messages in "All Mail"
Examples:
| mailbox |
| Spam |
| Trash |