mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 15:46:44 +00:00
fix(GODT-2763): Missing Answered flag on Sync and Message Create
Ensure we are using the same flag conversion code for all IMAP updates.
This commit is contained in:
@ -851,25 +851,3 @@ func safePublishMessageUpdate(user *User, addressID string, update imap.Update)
|
|||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildFlagSetFromMessageMetadata(message proton.MessageMetadata) imap.FlagSet {
|
|
||||||
flags := imap.NewFlagSet()
|
|
||||||
|
|
||||||
if message.Seen() {
|
|
||||||
flags.AddToSelf(imap.FlagSeen)
|
|
||||||
}
|
|
||||||
|
|
||||||
if message.Starred() {
|
|
||||||
flags.AddToSelf(imap.FlagFlagged)
|
|
||||||
}
|
|
||||||
|
|
||||||
if message.IsDraft() {
|
|
||||||
flags.AddToSelf(imap.FlagDraft)
|
|
||||||
}
|
|
||||||
|
|
||||||
if message.IsRepliedAll == true || message.IsReplied == true { //nolint: gosimple
|
|
||||||
flags.AddToSelf(imap.FlagAnswered)
|
|
||||||
}
|
|
||||||
|
|
||||||
return flags
|
|
||||||
}
|
|
||||||
|
|||||||
@ -608,19 +608,7 @@ func (conn *imapConnector) importMessage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func toIMAPMessage(message proton.MessageMetadata) imap.Message {
|
func toIMAPMessage(message proton.MessageMetadata) imap.Message {
|
||||||
flags := imap.NewFlagSet()
|
flags := buildFlagSetFromMessageMetadata(message)
|
||||||
|
|
||||||
if !message.Unread {
|
|
||||||
flags = flags.Add(imap.FlagSeen)
|
|
||||||
}
|
|
||||||
|
|
||||||
if slices.Contains(message.LabelIDs, proton.StarredLabel) {
|
|
||||||
flags = flags.Add(imap.FlagFlagged)
|
|
||||||
}
|
|
||||||
|
|
||||||
if slices.Contains(message.LabelIDs, proton.DraftsLabel) {
|
|
||||||
flags = flags.Add(imap.FlagDraft)
|
|
||||||
}
|
|
||||||
|
|
||||||
var date time.Time
|
var date time.Time
|
||||||
|
|
||||||
@ -713,3 +701,25 @@ func toIMAPMailbox(label proton.Label, flags, permFlags, attrs imap.FlagSet) ima
|
|||||||
func isAllMailOrScheduled(mailboxID imap.MailboxID) bool {
|
func isAllMailOrScheduled(mailboxID imap.MailboxID) bool {
|
||||||
return (mailboxID == proton.AllMailLabel) || (mailboxID == proton.AllScheduledLabel)
|
return (mailboxID == proton.AllMailLabel) || (mailboxID == proton.AllScheduledLabel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func buildFlagSetFromMessageMetadata(message proton.MessageMetadata) imap.FlagSet {
|
||||||
|
flags := imap.NewFlagSet()
|
||||||
|
|
||||||
|
if message.Seen() {
|
||||||
|
flags.AddToSelf(imap.FlagSeen)
|
||||||
|
}
|
||||||
|
|
||||||
|
if message.Starred() {
|
||||||
|
flags.AddToSelf(imap.FlagFlagged)
|
||||||
|
}
|
||||||
|
|
||||||
|
if message.IsDraft() {
|
||||||
|
flags.AddToSelf(imap.FlagDraft)
|
||||||
|
}
|
||||||
|
|
||||||
|
if message.IsRepliedAll == true || message.IsReplied == true { //nolint: gosimple
|
||||||
|
flags.AddToSelf(imap.FlagAnswered)
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user