From 706a944acfb687a078080d0aa4bc97a371292c9c Mon Sep 17 00:00:00 2001 From: Kate Hudson Date: Thu, 19 Oct 2017 12:02:28 -0400 Subject: [PATCH] Return early when onboarding notifications aren't finished (#285) --- snippets/base/templates/base/includes/snippet_as.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/snippets/base/templates/base/includes/snippet_as.js b/snippets/base/templates/base/includes/snippet_as.js index e37a93cc8..b2bbcc96b 100644 --- a/snippets/base/templates/base/includes/snippet_as.js +++ b/snippets/base/templates/base/includes/snippet_as.js @@ -6,10 +6,19 @@ var ABOUTHOME_SHOWN_SNIPPET = null; var USER_COUNTRY = null; var GEO_CACHE_DURATION = 1000 * 60 * 60 * 24 * 30; // 30 days - -(function() { +(async function() { 'use strict'; + // See https://github.com/mozilla/activity-stream/blob/master/docs/v2-system-addon/snippets.md + // for documentation on the gSnippetsMap API + + // If onboardingFinished is false, there may already be an onboarding snippet + // shown so we cannot show a snippet. However, .disableOnboarding() can be + // called so that it won't be shown on the *next* new tab + if (gSnippetsMap.get("appData.onboardingFinished") === false) { + return; + } + // Fetch user country if we don't have it. if (!haveUserCountry()) { downloadUserCountry();