Other: Flag messages imported into "Sent" mailbox as Sent
This commit is contained in:
parent
9f7cda3b69
commit
d720feaa6d
|
@ -22,6 +22,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/mail"
|
"net/mail"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/ProtonMail/go-proton-api"
|
"github.com/ProtonMail/go-proton-api"
|
||||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||||
|
@ -261,13 +262,22 @@ func (s *scenario) theAddressOfAccountHasTheFollowingMessagesInMailbox(address,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var messageFlags proton.MessageFlag
|
||||||
|
|
||||||
|
if !strings.EqualFold(mailbox, "Sent") {
|
||||||
|
messageFlags = proton.MessageFlagReceived
|
||||||
|
} else {
|
||||||
|
messageFlags = proton.MessageFlagSent
|
||||||
|
}
|
||||||
|
|
||||||
return s.t.createMessages(ctx, username, addrID, xslices.Map(wantMessages, func(message Message) proton.ImportReq {
|
return s.t.createMessages(ctx, username, addrID, xslices.Map(wantMessages, func(message Message) proton.ImportReq {
|
||||||
return proton.ImportReq{
|
return proton.ImportReq{
|
||||||
|
|
||||||
Metadata: proton.ImportMetadata{
|
Metadata: proton.ImportMetadata{
|
||||||
AddressID: addrID,
|
AddressID: addrID,
|
||||||
LabelIDs: []string{mboxID},
|
LabelIDs: []string{mboxID},
|
||||||
Unread: proton.Bool(message.Unread),
|
Unread: proton.Bool(message.Unread),
|
||||||
Flags: proton.MessageFlagReceived,
|
Flags: messageFlags,
|
||||||
},
|
},
|
||||||
Message: message.Build(),
|
Message: message.Build(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue