mirror of
https://github.com/ProtonMail/go-proton-api.git
synced 2026-05-19 05:46:33 -04:00
fix: Removing from inbox shouldn't remove from trash
This commit is contained in:
committed by
LBeernaertProton
parent
5110649c02
commit
e2fc4deffe
@@ -17,10 +17,15 @@ type message struct {
|
||||
externalID string
|
||||
addrID string
|
||||
labelIDs []string
|
||||
sysLabel *string
|
||||
attIDs []string
|
||||
inReplyTo string
|
||||
|
||||
// sysLabel is the system label for the message.
|
||||
// If nil, the message's flags are used to determine the system label (inbox, sent, drafts).
|
||||
// If "", the message has no system label (e.g. is in a custom folder or all mail).
|
||||
// If non-nil and non-empty, the message has the system label with the given ID (e.g. spam, trash).
|
||||
sysLabel *string
|
||||
|
||||
subject string
|
||||
sender *mail.Address
|
||||
toList []*mail.Address
|
||||
@@ -334,7 +339,9 @@ func (msg *message) remLabel(labelID string, labels map[string]*label) {
|
||||
}
|
||||
|
||||
func (msg *message) remFlagLabel(labelID string, labels map[string]*label) {
|
||||
msg.sysLabel = pointer("")
|
||||
if msg.sysLabel == nil {
|
||||
msg.sysLabel = pointer("")
|
||||
}
|
||||
}
|
||||
|
||||
func (msg *message) remSystemLabel(labelID string, labels map[string]*label) {
|
||||
|
||||
@@ -939,6 +939,12 @@ func TestServer_Labels(t *testing.T) {
|
||||
actions: []any{add(proton.TrashLabel), rem(proton.TrashLabel)},
|
||||
wantLabelIDs: []string{proton.AllMailLabel, proton.AllSentLabel},
|
||||
},
|
||||
{
|
||||
name: "received flag, add inbox, add trash, remove inbox",
|
||||
flags: proton.MessageFlagReceived,
|
||||
actions: []any{add(proton.InboxLabel), add(proton.TrashLabel), rem(proton.InboxLabel)},
|
||||
wantLabelIDs: []string{proton.AllMailLabel, proton.TrashLabel},
|
||||
},
|
||||
}
|
||||
|
||||
withServer(t, func(ctx context.Context, s *Server, m *proton.Manager) {
|
||||
|
||||
Reference in New Issue
Block a user