Fix js_config breaking when tracker_url not configured.

The pageview pixel code expects various things (the base URL, the secret
token, etc.) to be configured. Other places (like base.html) always
check if `g.tracker_url` is valid before generating the pageview pixel.
This was broken in 1f6a9aa570 when
`js_config()` started calling `get_pageview_pixel_url()`
indiscriminately.  Ouch for poor open source and dev installs.
This commit is contained in:
Neil Williams
2015-08-02 01:18:04 -07:00
parent c9c43426cc
commit fcdd4f7afc

View File

@@ -178,7 +178,7 @@ def js_config(extra_config=None):
"loading": _("loading...")
},
"is_fake": isinstance(c.site, FakeSubreddit),
"tracker_url": tracking.get_pageview_pixel_url() or '',
"tracker_url": "", # overridden below if configured
"adtracker_url": g.adtracker_url,
"clicktracker_url": g.clicktracker_url,
"uitracker_url": g.uitracker_url,
@@ -199,6 +199,9 @@ def js_config(extra_config=None):
"facebook_app_id": g.live_config["facebook_app_id"],
}
if g.tracker_url:
config["tracker_url"] = tracking.get_pageview_pixel_url()
if g.uncompressedJS:
config["uncompressedJS"] = True