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

Side by Side Diff: lib/uninstall.js

Issue 29336255: Issue 3649 - Truncate notificationDownloadCount (Closed)
Patch Set: Addressed Sebastian's feedback Created Feb. 11, 2016, 2:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 12 matching lines...) Expand all
23 23
24 function setUninstallURL() 24 function setUninstallURL()
25 { 25 {
26 let search = []; 26 let search = [];
27 let keys = ["addonName", "addonVersion", "application", "applicationVersion", 27 let keys = ["addonName", "addonVersion", "application", "applicationVersion",
28 "platform", "platformVersion"]; 28 "platform", "platformVersion"];
29 for (let key of keys) 29 for (let key of keys)
30 search.push(key + "=" + encodeURIComponent(info[key])); 30 search.push(key + "=" + encodeURIComponent(info[key]));
31 31
32 let downlCount = Prefs.notificationdata.downloadCount || 0; 32 let downlCount = Prefs.notificationdata.downloadCount || 0;
33
34 // FIXME - Once the changes for issue #3650 land and are included we should
35 // remove this check. (The number will be already truncated for us.)
36 if (downlCount > 4)
37 downlCount = "4+";
38
33 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); 39 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount));
34 40
35 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" + 41 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" +
36 search.join("&")); 42 search.join("&"));
37 } 43 }
38 44
39 // The uninstall URL contains the notification download count as a parameter, 45 // The uninstall URL contains the notification download count as a parameter,
40 // therefore we must wait for preferences to be loaded before generating the 46 // therefore we must wait for preferences to be loaded before generating the
41 // URL and we need to re-generate it each time the notification data changes. 47 // URL and we need to re-generate it each time the notification data changes.
42 if ("setUninstallURL" in chrome.runtime) 48 if ("setUninstallURL" in chrome.runtime)
43 { 49 {
44 Prefs.isLoaded.then(setUninstallURL); 50 Prefs.isLoaded.then(setUninstallURL);
45 Prefs.onChanged.addListener(function(name) 51 Prefs.onChanged.addListener(function(name)
46 { 52 {
47 if (name == "notificationdata") 53 if (name == "notificationdata")
48 setUninstallURL(); 54 setUninstallURL();
49 }); 55 });
50 } 56 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld