Skip to content

Commit

Permalink
Fix preview: Don't refer to gSnippetsMap when in preview.
Browse files Browse the repository at this point in the history
  • Loading branch information
glogiotatidis committed Oct 19, 2017
1 parent 706a944 commit de9629a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions snippets/base/templates/base/includes/snippet_as.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ var GEO_CACHE_DURATION = 1000 * 60 * 60 * 24 * 30; // 30 days
// 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;
}
{% if not preview %}
// Fetch user country if we don't have it.
if (!haveUserCountry()) {
downloadUserCountry();
}

// Fetch user country if we don't have it.
if (!haveUserCountry()) {
downloadUserCountry();
}
// 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;
}
{% endif %}

if (ABOUTHOME_SNIPPETS.length > 0) {
ABOUTHOME_SHOWN_SNIPPET = chooseSnippet(ABOUTHOME_SNIPPETS);
Expand Down

0 comments on commit de9629a

Please sign in to comment.