in webmail, automatically mark message as nonjunk when open for 5 seconds, and prevent extraneous newlines when composing a reply to selected text

This commit is contained in:
Mechiel Lukkien 2023-08-09 09:45:54 +02:00
parent 34ede1075d
commit 20ebdae8ea
No known key found for this signature in database
2 changed files with 16 additions and 4 deletions

View file

@ -2055,7 +2055,6 @@ const compose = (opts) => {
let haveFrom = false;
const fromOptions = accountAddresses.map(a => {
const selected = opts.from && opts.from.length === 1 && equalAddress(a, opts.from[0]) || loginAddress && equalAddress(a, loginAddress) && (!opts.from || envelopeIdentity(opts.from));
log('fromOptions', a, selected, loginAddress, equalAddress(a, loginAddress));
const o = dom.option(formatAddressFull(a), selected ? attr.selected('') : []);
if (selected) {
haveFrom = true;
@ -2608,7 +2607,7 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
// text to use when writing a reply. We still set url so the text content can be
// opened in a separate tab, even though it will look differently.
urlType = 'text';
const elem = dom.div(dom._class('mono'), style({ whiteSpace: 'pre-wrap' }), join((pm.Texts || []).map(t => renderText(t)), () => dom.hr(style({ margin: '2ex 0' }))));
const elem = dom.div(dom._class('mono'), style({ whiteSpace: 'pre-wrap' }), join((pm.Texts || []).map(t => renderText(t.replace(/\r\n/g, '\n'))), () => dom.hr(style({ margin: '2ex 0' }))));
dom._kids(msgcontentElem);
dom._kids(msgscrollElem, elem);
dom._kids(msgcontentElem, msgscrollElem);
@ -2702,6 +2701,13 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
}
}, 500);
}
if (!miv.messageitem.Message.Junk && !miv.messageitem.Message.Notjunk) {
window.setTimeout(async () => {
if (!miv.messageitem.Message.Junk && !miv.messageitem.Message.Notjunk && miv.messageitem.Message.ID === msglistView.activeMessageID()) {
await withStatus('Marking current message as not junk', client.FlagsAdd([miv.messageitem.Message.ID], ['$notjunk']));
}
}, 5 * 1000);
}
})();
return mv;
};

View file

@ -1319,7 +1319,6 @@ const compose = (opts: ComposeOptions) => {
let haveFrom = false
const fromOptions = accountAddresses.map(a => {
const selected = opts.from && opts.from.length === 1 && equalAddress(a, opts.from[0]) || loginAddress && equalAddress(a, loginAddress) && (!opts.from || envelopeIdentity(opts.from))
log('fromOptions', a, selected, loginAddress, equalAddress(a, loginAddress!))
const o = dom.option(formatAddressFull(a), selected ? attr.selected('') : [])
if (selected) {
haveFrom = true
@ -2206,7 +2205,7 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
urlType = 'text'
const elem = dom.div(dom._class('mono'),
style({whiteSpace: 'pre-wrap'}),
join((pm.Texts || []).map(t => renderText(t)), () => dom.hr(style({margin: '2ex 0'}))),
join((pm.Texts || []).map(t => renderText(t.replace(/\r\n/g, '\n'))), () => dom.hr(style({margin: '2ex 0'}))),
)
dom._kids(msgcontentElem)
dom._kids(msgscrollElem, elem)
@ -2336,6 +2335,13 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
}
}, 500)
}
if (!miv.messageitem.Message.Junk && !miv.messageitem.Message.Notjunk) {
window.setTimeout(async () => {
if (!miv.messageitem.Message.Junk && !miv.messageitem.Message.Notjunk && miv.messageitem.Message.ID === msglistView.activeMessageID()) {
await withStatus('Marking current message as not junk', client.FlagsAdd([miv.messageitem.Message.ID], ['$notjunk']))
}
}, 5*1000)
}
})()
return mv