mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
webmail: when replying to message we sent, don't compose the reply to ourselve, but copy the original to/cc/bcc headers
This commit is contained in:
parent
fb81effe45
commit
7c1879da82
2 changed files with 21 additions and 12 deletions
|
@ -2784,7 +2784,7 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
|
|||
parsedMessageResolve = resolve;
|
||||
parsedMessageReject = reject;
|
||||
});
|
||||
const react = async (to, forward, all) => {
|
||||
const react = async (to, cc, bcc, forward, all) => {
|
||||
const pm = await parsedMessagePromise;
|
||||
let body = '';
|
||||
const sel = window.getSelection();
|
||||
|
@ -2821,9 +2821,9 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
|
|||
subject = (RegExp('^' + subjectPrefix, 'i').test(subject) ? '' : subjectPrefix + ' ') + subject;
|
||||
const opts = {
|
||||
from: mi.Envelope.To || undefined,
|
||||
to: (to || []).map(a => formatAddress(a)),
|
||||
cc: [],
|
||||
bcc: [],
|
||||
to: to.map(a => formatAddress(a)),
|
||||
cc: cc.map(a => formatAddress(a)),
|
||||
bcc: bcc.map(a => formatAddress(a)),
|
||||
subject: subject,
|
||||
body: body,
|
||||
isForward: forward,
|
||||
|
@ -2839,9 +2839,14 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
|
|||
compose(opts);
|
||||
};
|
||||
const reply = async (all, toOpt) => {
|
||||
await react(toOpt || ((mi.Envelope.ReplyTo || []).length > 0 ? mi.Envelope.ReplyTo : mi.Envelope.From) || null, false, all);
|
||||
if (!all && !toOpt && (mi.Envelope.From || []).length === 1 && envelopeIdentity(mi.Envelope.From || [])) {
|
||||
await react(mi.Envelope.To || [], mi.Envelope.CC || [], mi.Envelope.BCC || [], false, all);
|
||||
}
|
||||
else {
|
||||
await react(toOpt || ((mi.Envelope.ReplyTo || []).length > 0 ? mi.Envelope.ReplyTo : mi.Envelope.From) || [], [], [], false, all);
|
||||
}
|
||||
};
|
||||
const cmdForward = async () => { react([], true, false); };
|
||||
const cmdForward = async () => { react([], [], [], true, false); };
|
||||
const cmdReplyList = async () => {
|
||||
const pm = await parsedMessagePromise;
|
||||
if (pm.ListReplyAddress) {
|
||||
|
|
|
@ -2190,7 +2190,7 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
|||
parsedMessageReject = reject
|
||||
})
|
||||
|
||||
const react = async (to: api.MessageAddress[] | null, forward: boolean, all: boolean) => {
|
||||
const react = async (to: api.MessageAddress[], cc: api.MessageAddress[], bcc: api.MessageAddress[], forward: boolean, all: boolean) => {
|
||||
const pm = await parsedMessagePromise
|
||||
let body = ''
|
||||
const sel = window.getSelection()
|
||||
|
@ -2224,9 +2224,9 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
|||
subject = (RegExp('^'+subjectPrefix, 'i').test(subject) ? '' : subjectPrefix+' ') + subject
|
||||
const opts: ComposeOptions = {
|
||||
from: mi.Envelope.To || undefined,
|
||||
to: (to || []).map(a => formatAddress(a)),
|
||||
cc: [],
|
||||
bcc: [],
|
||||
to: to.map(a => formatAddress(a)),
|
||||
cc: cc.map(a => formatAddress(a)),
|
||||
bcc: bcc.map(a => formatAddress(a)),
|
||||
subject: subject,
|
||||
body: body,
|
||||
isForward: forward,
|
||||
|
@ -2243,9 +2243,13 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
|||
}
|
||||
|
||||
const reply = async (all: boolean, toOpt?: api.MessageAddress[]) => {
|
||||
await react(toOpt || ((mi.Envelope.ReplyTo || []).length > 0 ? mi.Envelope.ReplyTo : mi.Envelope.From) || null, false, all)
|
||||
if (!all && !toOpt && (mi.Envelope.From || []).length === 1 && envelopeIdentity(mi.Envelope.From || [])) {
|
||||
await react(mi.Envelope.To || [], mi.Envelope.CC || [], mi.Envelope.BCC || [], false, all)
|
||||
} else {
|
||||
await react(toOpt || ((mi.Envelope.ReplyTo || []).length > 0 ? mi.Envelope.ReplyTo : mi.Envelope.From) || [], [], [], false, all)
|
||||
}
|
||||
const cmdForward = async () => { react([], true, false) }
|
||||
}
|
||||
const cmdForward = async () => { react([], [], [], true, false) }
|
||||
const cmdReplyList = async () => {
|
||||
const pm = await parsedMessagePromise
|
||||
if (pm.ListReplyAddress) {
|
||||
|
|
Loading…
Reference in a new issue