Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: desktop-options.js

Issue 29609587: Issue 6031 - Implement Acceptable Ads notification (Closed)
Patch Set: Created Nov. 15, 2017, 5:01 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: desktop-options.js
===================================================================
--- a/desktop-options.js
+++ b/desktop-options.js
@@ -607,6 +607,9 @@
case "hide-notification":
hideNotification();
break;
+ case "hide-tracking-notification":
+ E("acceptable-ads").classList.remove("show-notification");
Thomas Greiner 2017/11/16 19:25:05 Let's remove this action and instead react to chan
saroyanm 2017/11/17 16:10:38 I agree, done.
+ break;
case "import-subscription": {
let url = E("blockingList-textbox").value;
addEnableSubscription(url);
@@ -1094,6 +1097,23 @@
return url == acceptableAdsUrl || url == acceptableAdsPrivacyUrl;
}
+ function hasPrivacyConflict()
+ {
+ let acceptableAdsList = subscriptionsMap[acceptableAdsUrl];
+ let privacyList = null;
+ for (let url in subscriptionsMap)
+ {
+ let subscription = subscriptionsMap[url];
+ if (subscription.recommended == "privacy")
+ {
+ privacyList = subscription;
+ break;
+ }
+ }
+ return acceptableAdsList && acceptableAdsList.disabled == false &&
+ privacyList && privacyList.disabled == false;
+ }
+
function populateLists()
{
subscriptionsMap = Object.create(null);
@@ -1267,6 +1287,16 @@
if (isAcceptableAds(url))
setAcceptableAds();
+ if ((url == acceptableAdsUrl || recommended == "privacy") &&
+ hasPrivacyConflict())
+ {
+ getPref("ui_warn_tracking", (showTrackingWarning) =>
+ {
+ if (showTrackingWarning)
+ E("acceptable-ads").classList.add("show-notification");
+ });
+ }
+
collections.filterLists.addItem(subscription);
break;
case "removed":
@@ -1415,7 +1445,8 @@
browser.runtime.sendMessage({
type: "prefs.listen",
filter: ["notifications_ignoredcategories", "notifications_showui",
- "show_devtools_panel", "shouldShowBlockElementMenu"]
+ "show_devtools_panel", "shouldShowBlockElementMenu",
+ "ui_warn_tracking"]
});
browser.runtime.sendMessage({
type: "subscriptions.listen",

Powered by Google App Engine
This is Rietveld