From a3ac16473036b97a656ef5ba32cdb930ff494b81 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 10 Nov 2019 22:59:41 -0500 Subject: [PATCH] Bug 809513 - Prevent unread Drafts from showing in new mail notification. Change mainly affects Windows. However, Linux integration also changed so that it also allows new mail notification to occur for folder with SentMail flag. Tag #1273 --- mailnews/base/content/newmailalert.js | 20 +++++++++++++------ .../base/src/nsMessengerUnixIntegration.cpp | 12 +++++++---- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/mailnews/base/content/newmailalert.js b/mailnews/base/content/newmailalert.js index 2439340920..f54d165b1e 100644 --- a/mailnews/base/content/newmailalert.js +++ b/mailnews/base/content/newmailalert.js @@ -57,12 +57,20 @@ function prefillAlertInfo() folderSummaryInfoEl.mMaxMsgHdrsInPopup = gNumNewMsgsToShowInAlert; for (let folder in fixIterator(allFolders, Components.interfaces.nsIMsgFolder)) { - if (folder.hasNewMessages && !folder.getFlag(Ci.nsMsgFolderFlags.Virtual)) - { - var asyncFetch = {}; - folderSummaryInfoEl.parseFolder(folder, new urlListener(folder), asyncFetch); - if (asyncFetch.value) - gPendingPreviewFetchRequests++; + if (folder.hasNewMessages) { + let notify = + // Any folder which is an inbox or ... + folder.getFlag(Ci.nsMsgFolderFlags.Inbox) || + // any non-special or non-virtual folder. In other words, we don't + // notify for Drafts|Trash|SentMail|Templates|Junk|Archive|Queue or virtual. + !(folder.flags & (Ci.nsMsgFolderFlags.SpecialUse | Ci.nsMsgFolderFlags.Virtual)); + + if (notify) { + var asyncFetch = {}; + folderSummaryInfoEl.parseFolder(folder, new urlListener(folder), asyncFetch); + if (asyncFetch.value) + gPendingPreviewFetchRequests++; + } } } } diff --git a/mailnews/base/src/nsMessengerUnixIntegration.cpp b/mailnews/base/src/nsMessengerUnixIntegration.cpp index 0e4dd14051..cb76a5fba7 100644 --- a/mailnews/base/src/nsMessengerUnixIntegration.cpp +++ b/mailnews/base/src/nsMessengerUnixIntegration.cpp @@ -609,10 +609,14 @@ nsresult nsMessengerUnixIntegration::GetFirstFolderWithNewMail(nsACString& aFold if (NS_FAILED(rv)) continue; - // Unless we're dealing with an Inbox, we don't care - // about Drafts, Queue, SentMail, Template, or Junk folders - if (!(flags & nsMsgFolderFlags::Inbox) && - (flags & (nsMsgFolderFlags::SpecialUse & ~nsMsgFolderFlags::Inbox))) + bool notify = + // Any folder which is an inbox or ... + flags & nsMsgFolderFlags::Inbox || + // any non-special or non-virtual folder. In other words, we don't + // notify for Drafts|Trash|SentMail|Templates|Junk|Archive|Queue or virtual. + !(flags & (nsMsgFolderFlags::SpecialUse | nsMsgFolderFlags::Virtual)); + + if (!notify) continue; nsCString folderURI;