forked from Silverfish/proton-bridge
GODT-1433 Message.Type is deprecated, use Flags instead.
This commit is contained in:
@ -177,10 +177,8 @@ func (ctl *Controller) SetDraftBody(username string, messageID string, body stri
|
||||
message.Body = body
|
||||
|
||||
// assuming this is draft we set following
|
||||
// - Draft type (NOTE: Type is not part of pmapi.MessageEvent, but it's there on API)
|
||||
// - It must not have FlagReceived and FlagSent
|
||||
// - Standard labelsIDs NOTE:wrong behaviour once we will have edge case tests for drafts outside draft folder
|
||||
message.Type = pmapi.MessageTypeDraft
|
||||
message.Flags = pmapi.FlagE2E | pmapi.FlagInternal
|
||||
message.LabelIDs = []string{pmapi.AllDraftsLabel, pmapi.AllMailLabel, pmapi.DraftLabel}
|
||||
|
||||
|
||||
@ -179,6 +179,7 @@ func (api *FakePMAPI) SendMessage(ctx context.Context, messageID string, sendMes
|
||||
}
|
||||
message.Time = time.Now().Unix()
|
||||
message.LabelIDs = append(message.LabelIDs, pmapi.SentLabel)
|
||||
message.Flags |= pmapi.FlagSent
|
||||
api.addEventMessage(pmapi.EventUpdate, message)
|
||||
return message, nil, nil
|
||||
}
|
||||
|
||||
@ -25,6 +25,12 @@ Feature: IMAP operations with Drafts
|
||||
When IMAP client fetches body of UID "1"
|
||||
Then IMAP response is "OK"
|
||||
Then IMAP response contains "Nope"
|
||||
When IMAP client sends command "UID FETCH 1 RFC822.SIZE"
|
||||
Then IMAP response is "OK"
|
||||
Then IMAP response contains "495"
|
||||
When IMAP client sends command "UID FETCH 1 BODYSTRUCTURE"
|
||||
Then IMAP response is "OK"
|
||||
Then IMAP response contains "4 14"
|
||||
Given the body of draft "msg1" for "user" has changed to "Yes I am"
|
||||
And the event loop of "user" loops once
|
||||
And mailbox "Drafts" for "user" has 1 messages
|
||||
@ -32,4 +38,10 @@ Feature: IMAP operations with Drafts
|
||||
Then IMAP response is "OK"
|
||||
Then IMAP response contains "Yes I am"
|
||||
Then IMAP response does not contain "Nope"
|
||||
When IMAP client sends command "UID FETCH 2 RFC822.SIZE"
|
||||
Then IMAP response is "OK"
|
||||
Then IMAP response contains "499"
|
||||
When IMAP client sends command "UID FETCH 2 BODYSTRUCTURE"
|
||||
Then IMAP response is "OK"
|
||||
Then IMAP response contains "8 14"
|
||||
|
||||
|
||||
@ -108,16 +108,15 @@ func thereAreMessagesInMailboxesForAddressOfUser(mailboxNames, bddAddressID, bdd
|
||||
|
||||
if message.HasLabelID(pmapi.SentLabel) {
|
||||
message.Flags |= pmapi.FlagSent
|
||||
message.Type = pmapi.MessageTypeSent
|
||||
} else {
|
||||
// some tests (Outlook move by DELETE EXPUNGE APPEND) imply creating hard copies of emails,
|
||||
// and the importMessage() function flags the email as Sent if the 'Received' key in not present in the
|
||||
// header.
|
||||
header.Add("Received", "from dummy.protonmail.com")
|
||||
message.Flags |= pmapi.FlagReceived
|
||||
}
|
||||
|
||||
if message.HasLabelID(pmapi.DraftLabel) {
|
||||
message.Type = pmapi.MessageTypeDraft
|
||||
message.Flags = pmapi.FlagInternal | pmapi.FlagE2E
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user