Bug 1571287 - Add isShowingJunkNotification for LookOut add-on. r=IanN

This commit is contained in:
Frank-Rainer Grahl 2019-08-11 13:43:23 +02:00
Родитель 85bbcda6a3
Коммит 29637dee5c
1 изменённых файлов: 10 добавлений и 5 удалений

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

@ -2490,12 +2490,11 @@ function HandleJunkStatusChanged(folder)
if (GetNumSelectedMessages() == 1)
msgHdr = messenger.msgHdrFromURI(loadedMessage);
var junkBarWasDisplayed = gMessageNotificationBar.mMsgNotificationBar.getNotificationWithValue("junkContent");
var junkBarWasDisplayed = gMessageNotificationBar.isShowingJunkNotification();
gMessageNotificationBar.setJunkMsg(msgHdr);
var isJunk = gMessageNotificationBar.mMsgNotificationBar.getNotificationWithValue("junkContent");
// Only reload message if junk bar display state has changed.
if (msgHdr && junkBarWasDisplayed != isJunk)
if (msgHdr && junkBarWasDisplayed != gMessageNotificationBar.isShowingJunkNotification())
{
// We may be forcing junk mail to be rendered with sanitized html.
// In that scenario, we want to reload the message if the status has just
@ -2505,6 +2504,9 @@ function HandleJunkStatusChanged(folder)
// Only bother doing this if we are modifying the html for junk mail...
if (sanitizeJunkMail)
{
let junkScore = msgHdr.getStringProperty("junkscore");
let isJunk = (junkScore == Ci.nsIJunkMailPlugin.IS_SPAM_SCORE);
// If the current row isn't going to change, reload to show sanitized or
// unsanitized. Otherwise we wouldn't see the reloaded version anyway.
@ -2555,10 +2557,9 @@ var gMessageNotificationBar =
goUpdateCommand('button_junk');
let oldNotif = this.mMsgNotificationBar.getNotificationWithValue("junkContent");
if (isJunk)
{
if (!oldNotif)
if (!this.isShowingJunkNotification())
{
let brandName = this.mBrandBundle.getString("brandShortName");
let junkBarMsg = this.mStringBundle.getFormattedString('junkBarMessage',
@ -2593,6 +2594,10 @@ var gMessageNotificationBar =
remoteOrigins: null,
isShowingJunkNotification: function() {
return !!this.mMsgNotificationBar.getNotificationWithValue("junkContent");
},
setRemoteContentMsg: function(aMsgHdr, aContentURI, aCanOverride)
{
// remoteOrigins is a Set of all blockable Origins.