Skip to content

Commit

Permalink
fix: Only clear recent flag if message flag is present
Browse files Browse the repository at this point in the history
  • Loading branch information
LBeernaertProton authored and jameshoulahan committed Sep 6, 2022
1 parent 76ec165 commit 192545f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/state/responders.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ func (u *exists) handle(ctx context.Context, tx *ent.Tx, snap *snapshot) ([]resp
res := []response.Response{response.Exists().WithCount(seq)}

if recent := len(snap.getMessagesWithFlag(imap.FlagRecent)); recent > 0 {
if err := db.ClearRecentFlag(ctx, tx, snap.mboxID.InternalID, u.messageID); err != nil {
if msgFlags, err := snap.getMessageFlags(u.messageID); err != nil {
return nil, err
} else if msgFlags.Contains(imap.FlagRecent) {
if err := db.ClearRecentFlag(ctx, tx, snap.mboxID.InternalID, u.messageID); err != nil {
return nil, err
}
}

res = append(res, response.Recent().WithCount(recent))
Expand Down

0 comments on commit 192545f

Please sign in to comment.