mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1227743 - Remove snippet (id) from rotation after the user clicks on it. r=mfinkle
MozReview-Commit-ID: 10m8yssL94U
This commit is contained in:
parent
95cb251e3f
commit
b3e6967557
@ -204,12 +204,11 @@ function updateBanner(messages) {
|
||||
weight: message.weight,
|
||||
onclick: function() {
|
||||
gChromeWin.BrowserApp.loadURI(message.url);
|
||||
removeSnippet(id, message.id);
|
||||
UITelemetry.addEvent("action.1", "banner", null, message.id);
|
||||
},
|
||||
ondismiss: function() {
|
||||
// Remove this snippet from the banner, and store its id so we'll never show it again.
|
||||
Home.banner.remove(id);
|
||||
removeSnippet(message.id);
|
||||
removeSnippet(id, message.id);
|
||||
UITelemetry.addEvent("cancel.1", "banner", null, message.id);
|
||||
},
|
||||
onshown: function() {
|
||||
@ -225,11 +224,19 @@ function updateBanner(messages) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends snippet id to the end of `snippets-removed.txt`
|
||||
* Removes a snippet message from the home banner rotation, and stores its
|
||||
* snippet id in a pref so we'll never show it again.
|
||||
*
|
||||
* @param messageId unique id for home banner message, returned from Home.banner API
|
||||
* @param snippetId unique id for snippet, sent from snippets server
|
||||
*/
|
||||
function removeSnippet(snippetId) {
|
||||
function removeSnippet(messageId, snippetId) {
|
||||
// Remove the message from the home banner rotation.
|
||||
Home.banner.remove(messageId);
|
||||
|
||||
// Remove the message from the stored message ids.
|
||||
gMessageIds.splice(gMessageIds.indexOf(messageId), 1);
|
||||
|
||||
let removedSnippetIds;
|
||||
try {
|
||||
removedSnippetIds = JSON.parse(Services.prefs.getCharPref(SNIPPETS_REMOVED_IDS_PREF));
|
||||
|
Loading…
Reference in New Issue
Block a user