From 43100d11bfdc59ed27653cea15ca67c75bacc01a Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Wed, 1 Feb 2023 15:53:27 +0100 Subject: [PATCH] fix(GODT-2323): Fix Expunge not issued for move When moving between system labels the expunge commands were not being issued. --- go.mod | 2 +- go.sum | 4 ++-- internal/user/imap.go | 2 +- tests/features/imap/message/move.feature | 23 +++++++++++++++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index f4415882..d97ba6d5 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/Masterminds/semver/v3 v3.1.1 github.com/ProtonMail/gluon v0.14.2-0.20230207072331-53797c5aa3f6 github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a - github.com/ProtonMail/go-proton-api v0.3.1-0.20230206154154-9a48fdf76620 + github.com/ProtonMail/go-proton-api v0.3.1-0.20230207122130-dd2095ddc7fe github.com/ProtonMail/go-rfc5322 v0.11.0 github.com/ProtonMail/gopenpgp/v2 v2.4.10 github.com/PuerkitoBio/goquery v1.8.0 diff --git a/go.sum b/go.sum index 78988c10..b29eaba2 100644 --- a/go.sum +++ b/go.sum @@ -41,8 +41,8 @@ github.com/ProtonMail/go-message v0.0.0-20210611055058-fabeff2ec753/go.mod h1:NB github.com/ProtonMail/go-mime v0.0.0-20220302105931-303f85f7fe0f/go.mod h1:NYt+V3/4rEeDuaev/zw1zCq8uqVEuPHzDPo3OZrlGJ4= github.com/ProtonMail/go-mime v0.0.0-20220429130430-2192574d760f h1:4IWzKjHzZxdrW9k4zl/qCwenOVHDbVDADPPHFLjs0Oc= github.com/ProtonMail/go-mime v0.0.0-20220429130430-2192574d760f/go.mod h1:qRZgbeASl2a9OwmsV85aWwRqic0NHPh+9ewGAzb4cgM= -github.com/ProtonMail/go-proton-api v0.3.1-0.20230206154154-9a48fdf76620 h1:I3yjl4TuEm1t56fKQ38OpvmFHSUrMH9eQ5I6C5Y3Bfc= -github.com/ProtonMail/go-proton-api v0.3.1-0.20230206154154-9a48fdf76620/go.mod h1:JUo5IQG0hNuPRuDpOUsCOvtee6UjTEHHF1QN2i8RSos= +github.com/ProtonMail/go-proton-api v0.3.1-0.20230207122130-dd2095ddc7fe h1:um5Kp4WLzq28G7JMafv9lpmXFxasyg4RI2MhEFRjoJY= +github.com/ProtonMail/go-proton-api v0.3.1-0.20230207122130-dd2095ddc7fe/go.mod h1:JUo5IQG0hNuPRuDpOUsCOvtee6UjTEHHF1QN2i8RSos= github.com/ProtonMail/go-rfc5322 v0.11.0 h1:o5Obrm4DpmQEffvgsVqG6S4BKwC1Wat+hYwjIp2YcCY= github.com/ProtonMail/go-rfc5322 v0.11.0/go.mod h1:6oOKr0jXvpoE6pwTx/HukigQpX2J9WUf6h0auplrFTw= github.com/ProtonMail/go-srp v0.0.5 h1:xhUioxZgDbCnpo9JehyFhwwsn9JLWkUGfB0oiKXgiGg= diff --git a/internal/user/imap.go b/internal/user/imap.go index 19fa3e10..35d3fecc 100644 --- a/internal/user/imap.go +++ b/internal/user/imap.go @@ -443,7 +443,7 @@ func (conn *imapConnector) MoveMessages(ctx context.Context, messageIDs []imap.M result = result || true } - if v, ok := conn.apiLabels[string(labelToID)]; ok && v.Type == proton.LabelTypeFolder { + if v, ok := conn.apiLabels[string(labelToID)]; ok && (v.Type == proton.LabelTypeFolder || v.Type == proton.LabelTypeSystem) { result = result || true } diff --git a/tests/features/imap/message/move.feature b/tests/features/imap/message/move.feature index f98cca25..272498d8 100644 --- a/tests/features/imap/message/move.feature +++ b/tests/features/imap/message/move.feature @@ -64,6 +64,29 @@ Feature: IMAP move messages | john.doe@mail.com | [user:user]@[domain] | baz | false | And IMAP client "1" sees 0 messages in "Labels/label2" + Scenario: Move message from system label to system label + When IMAP client "1" moves the message with subject "foo" from "INBOX" to "Trash" + And it succeeds + And IMAP client "1" sees the following messages in "INBOX": + | from | to | subject | unread | + | jane.doe@mail.com | name@[domain] | bar | true | + And IMAP client "1" sees the following messages in "Trash": + | from | to | subject | unread | + | john.doe@mail.com | [user:user]@[domain] | foo | false | + + Scenario: Move message from folder to system label + When IMAP client "1" moves the message with subject "baz" from "Labels/label2" to "Folders/mbox" + And it succeeds + And IMAP client "1" sees the following messages in "Folders/mbox": + | from | to | subject | unread | + | john.doe@mail.com | [user:user]@[domain] | baz | false | + When IMAP client "1" moves the message with subject "baz" from "Folders/mbox" to "Trash" + And it succeeds + And IMAP client "1" sees 0 messages in "Folders/mbox" + And IMAP client "1" sees the following messages in "Trash": + | from | to | subject | unread | + | john.doe@mail.com | [user:user]@[domain] | baz | false | + Scenario: Move message from All Mail is not possible When IMAP client "1" moves the message with subject "baz" from "All Mail" to "Folders/folder" Then it fails