Bug 1782719 - Don't mark NotJunk flagged mails as junk (e.g. Yahoo.). r=benc

Differential Revision: https://phabricator.services.mozilla.com/D155667

--HG--
extra : rebase_source : 5333f215f81bc5af2c9bab04ad7560c15039c984
This commit is contained in:
Magnus Melin 2022-08-29 11:49:07 +10:00
Родитель 5bf021216a
Коммит 4762867b8e
2 изменённых файлов: 41 добавлений и 1 удалений

Просмотреть файл

@ -4459,8 +4459,10 @@ nsresult nsImapMailFolder::HandleCustomFlags(nsMsgKey uidOfMessage,
bool messageClassified = true;
// ### TODO: we really should parse the keywords into space delimited keywords
// before checking
// Mac Mail uses "NotJunk"
// Mac Mail, Yahoo uses "NotJunk"
if (FindInReadable("NonJunk"_ns, keywords,
nsCaseInsensitiveCStringComparator) ||
FindInReadable("NotJunk"_ns, keywords,
nsCaseInsensitiveCStringComparator)) {
nsAutoCString msgJunkScore;
msgJunkScore.AppendInt(nsIJunkMailPlugin::IS_HAM_SCORE);

Просмотреть файл

@ -158,6 +158,44 @@ add_task(async function checkTagSet() {
await listener.promise;
});
/** Test that the NonJunk tag from the server is noticed. */
add_task(async function checkNonJunkTagSet() {
gMessage.clearFlag("NotJunk");
gMessage.setFlag("NonJunk");
let listener = new PromiseTestUtils.PromiseUrlListener();
IMAPPump.inbox.updateFolderWithListener(null, listener);
await listener.promise;
let msgHdr = IMAPPump.inbox.msgDatabase.getMsgHdrForMessageID(
gSynthMessage.messageId
);
let junkScore = msgHdr.getStringProperty("junkscore");
Assert.equal(
junkScore,
Ci.nsIJunkMailPlugin.IS_HAM_SCORE,
"NonJunk flag on server should mark as ham"
);
});
/** Test that the NotJunk tag from the server is noticed. */
add_task(async function checkNotJunkTagSet() {
gMessage.clearFlag("NonJunk");
gMessage.setFlag("NotJunk");
let listener = new PromiseTestUtils.PromiseUrlListener();
IMAPPump.inbox.updateFolderWithListener(null, listener);
await listener.promise;
let msgHdr = IMAPPump.inbox.msgDatabase.getMsgHdrForMessageID(
gSynthMessage.messageId
);
let junkScore = msgHdr.getStringProperty("junkscore");
Assert.equal(
junkScore,
Ci.nsIJunkMailPlugin.IS_HAM_SCORE,
"NotJunk flag on server should mark as ham"
);
});
add_task(async function clearTag() {
gMessage.clearFlag("randomtag");
let listener = new PromiseTestUtils.PromiseUrlListener();