mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 10:34:40 +03:00
webmail: during "send and archive", don't fail with error message when message that is being responded to is already in archive folder
before this change, when archiving, we would move all messages from the thread that are in the same mailbox as that of the response message to the archive mailbox. so if the message that was being responsed to was already in the archive mailbox, the message would be moved from archive mailbox to archive mailbox, resulting in an error. with this change, when archiving, we move the thread messages that are in the same mailbox as is currently open (independent of the mailbox the message lives in, a common situation in the threading view). if there is no open mailbox (search results), we still use the mailbox of the message being responded to as reference. with this new approach, we won't get errors moving a message to an archive mailbox when it's already there. well, you can still get that error, but then you've got the archive mailbox open, or you're in a search result and responding to an archived message. the error should at least help understand that nothing is happening. we are only moving the messages from one active/reference mailbox because we don't want to move messages from the thread that are in the Sent mailbox, and we also don't want to move duplicate messages (cross-posts to mailing lists) that are in other mailboxes. moving only the messages from the current active mailbox seems safe, and should do what is what users would expect most of the time. for issue #233 by mattfbacon, thanks for reporting!
This commit is contained in:
@ -497,22 +497,23 @@ type Attachment struct {
|
||||
// Addresses are formatted as just email address, or with a name like "name
|
||||
// <user@host>".
|
||||
type SubmitMessage struct {
|
||||
From string
|
||||
To []string
|
||||
Cc []string
|
||||
Bcc []string
|
||||
ReplyTo string // If non-empty, Reply-To header to add to message.
|
||||
Subject string
|
||||
TextBody string
|
||||
Attachments []File
|
||||
ForwardAttachments ForwardAttachments
|
||||
IsForward bool
|
||||
ResponseMessageID int64 // If set, this was a reply or forward, based on IsForward.
|
||||
UserAgent string // User-Agent header added if not empty.
|
||||
RequireTLS *bool // For "Require TLS" extension during delivery.
|
||||
FutureRelease *time.Time // If set, time (in the future) when message should be delivered from queue.
|
||||
ArchiveThread bool // If set, thread is archived after sending message.
|
||||
DraftMessageID int64 // If set, draft message that will be removed after sending.
|
||||
From string
|
||||
To []string
|
||||
Cc []string
|
||||
Bcc []string
|
||||
ReplyTo string // If non-empty, Reply-To header to add to message.
|
||||
Subject string
|
||||
TextBody string
|
||||
Attachments []File
|
||||
ForwardAttachments ForwardAttachments
|
||||
IsForward bool
|
||||
ResponseMessageID int64 // If set, this was a reply or forward, based on IsForward.
|
||||
UserAgent string // User-Agent header added if not empty.
|
||||
RequireTLS *bool // For "Require TLS" extension during delivery.
|
||||
FutureRelease *time.Time // If set, time (in the future) when message should be delivered from queue.
|
||||
ArchiveThread bool // If set, thread is archived after sending message.
|
||||
ArchiveReferenceMailboxID int64 // If ArchiveThread is set, thread messages from this mailbox ID are moved to the archive mailbox ID. E.g. of Inbox.
|
||||
DraftMessageID int64 // If set, draft message that will be removed after sending.
|
||||
}
|
||||
|
||||
// ForwardAttachments references attachments by a list of message.Part paths.
|
||||
@ -1057,7 +1058,7 @@ func (w Webmail) MessageSubmit(ctx context.Context, m SubmitMessage) {
|
||||
|
||||
var msgIDs []int64
|
||||
q := bstore.QueryTx[store.Message](tx)
|
||||
q.FilterNonzero(store.Message{ThreadID: rm.ThreadID, MailboxID: rm.MailboxID})
|
||||
q.FilterNonzero(store.Message{ThreadID: rm.ThreadID, MailboxID: m.ArchiveReferenceMailboxID})
|
||||
q.FilterEqual("Expunged", false)
|
||||
err = q.IDs(&msgIDs)
|
||||
xcheckf(ctx, err, "listing messages in thread to archive")
|
||||
|
Reference in New Issue
Block a user