|
|
|
@ -23,7 +23,8 @@ const TbMessageView = {
|
|
|
|
|
}
|
|
|
|
|
for (let p of prefixes) {
|
|
|
|
|
let regEx = new RegExp(`^(${p}: )+`, "i");
|
|
|
|
|
subject = subject.replace(regEx, ""); // Remove prefix.
|
|
|
|
|
// Remove prefix.
|
|
|
|
|
subject = subject.replace(regEx, "");
|
|
|
|
|
}
|
|
|
|
|
let hadRe = (subject != content);
|
|
|
|
|
|
|
|
|
@ -33,22 +34,19 @@ const TbMessageView = {
|
|
|
|
|
// The database doesn't like raw UTF apparently.
|
|
|
|
|
subject = jsmime.headeremitter.emitStructuredHeader("subject", subject, {}).substring(9);
|
|
|
|
|
|
|
|
|
|
// We should store the subject without any Re: prefix, but
|
|
|
|
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1629555
|
|
|
|
|
// gets in the way. So the correct code is commented out for now.
|
|
|
|
|
// Correct would be these two lines ...
|
|
|
|
|
// if (hadRe) msgHdr.flags |= Ci.nsMsgMessageFlags.HasRe;
|
|
|
|
|
// msgHdr.subject = subject;
|
|
|
|
|
// ... and replace the if-else below.
|
|
|
|
|
if (msgHdr.flags & Ci.nsMsgMessageFlags.HasRe) {
|
|
|
|
|
// If the flag is already set, we can just store the subject.
|
|
|
|
|
msgHdr.subject = subject;
|
|
|
|
|
} else {
|
|
|
|
|
// This is WRONG. Should not prepend "Re: " but instead set the flag. See above.
|
|
|
|
|
// It would be nice to store the subject without the "Re:" prefix and set
|
|
|
|
|
// the HasRe flag instead. That works when calling
|
|
|
|
|
// tree.view.db.NotifyHdrChangeAll(msgHdr, msgHdr.flags | Ci.nsMsgMessageFlags.HasRe, msgHdr.flags, {});
|
|
|
|
|
// but sadly the solution falls apart when copying messages between
|
|
|
|
|
// IMAP folders or between local and IMAP folders.
|
|
|
|
|
// eslint-disable-next-line prefer-template
|
|
|
|
|
msgHdr.subject = hadRe ? "Re: " + subject : subject;
|
|
|
|
|
}
|
|
|
|
|
if (tree) tree.invalidate();
|
|
|
|
|
if (tree && tree.view && tree.view.selection) tree.invalidateRow(tree.view.selection.currentIndex);
|
|
|
|
|
|
|
|
|
|
return subject;
|
|
|
|
|
},
|
|
|
|
|