diff --git a/src/background.js b/src/background.js index 58265a7f7..9cbd953cc 100644 --- a/src/background.js +++ b/src/background.js @@ -1311,7 +1311,7 @@ offers.on('enabled', () => { * Set listener for 'enabled' event for Offers module. * It registers message handler for messages with the offers. * This handler adds incoming message data to the array of - * notimication messages (CMP_DATA) to be eventually displayed. + * notification messages (CMP_DATA) to be eventually displayed. * @memberOf Background */ messageCenter.on('enabled', () => { @@ -1319,7 +1319,7 @@ messageCenter.on('enabled', () => { log('IN MESSAGE CENTER ON ENABLED', offers, messageCenter); // const messageCenter = cliqz.modules['message-center']; return messageCenter.action('registerMessageHandler', OFFERS_HANDLER_ID, (msg) => { - // ffers enabled at the moment when message received + // offers enabled at the moment when message received messageCenter.action('hideMessage', OFFERS_HANDLER_ID, msg); msg.Dismiss = 1; // to be immediately dismissed once shown /** @@ -1356,7 +1356,8 @@ messageCenter.on('enabled', () => { rewards.unreadOfferIds.push(msg.data.offer_id); button.update(); - if (msg.data.offer_data.ui_info.notif_type !== 'star') { + // Don't show the Rewards hotdog if Ghostery is currently paused + if (msg.data.offer_data.ui_info.notif_type !== 'star' && !globals.SESSION.paused_blocking) { // We use getTabByUrl() instead of getActiveTab() // because user may open the offer-triggering url in a new tab // through the context menu, which may not switch to the new tab diff --git a/src/classes/EventHandlers.js b/src/classes/EventHandlers.js index dbbc3ef39..9c6f515d5 100644 --- a/src/classes/EventHandlers.js +++ b/src/classes/EventHandlers.js @@ -146,11 +146,17 @@ class EventHandlers { onDOMContentLoaded(details) { const tab_id = details.tabId; + // ignore if this is a sub-frame if (!utils.isValidTopLevelNavigation(details)) { return; } - // show upgrade notifications + // do not show CMP notifications if Ghostery is paused + if (globals.SESSION.paused_blocking) { + return; + } + + // show CMP upgrade notifications utils.getActiveTab((tab) => { if (!tab || tab.id !== tab_id || tab.incognito) { return; diff --git a/src/classes/Rewards.js b/src/classes/Rewards.js index 1175a0555..74ded9fd6 100644 --- a/src/classes/Rewards.js +++ b/src/classes/Rewards.js @@ -107,9 +107,8 @@ class Rewards { this.currentOffer = offer; const tab = tabInfo.getTabInfo(tab_id); - // If the tab is prefetched, we can't add purplebox to it. - if (!conf.enable_offers || - !tab || tab.rewards) { + // If the tab is prefetched, we can't add Rewards hotdog to it + if (!conf.enable_offers || !tab || tab.rewards) { return Promise.resolve(false); }