diff --git a/bedrock/firefox/urls.py b/bedrock/firefox/urls.py index a2b5fab1d1d..32ea207d29f 100644 --- a/bedrock/firefox/urls.py +++ b/bedrock/firefox/urls.py @@ -12,6 +12,7 @@ latest_re = r'^firefox(?:/(?P%s))?/%s/$' firstrun_re = latest_re % (version_re, 'firstrun') whatsnew_re = latest_re % (version_re, 'whatsnew') +whatsnew_re_all = latest_re % (version_re, 'whatsnew/all') tracking_protection_re = latest_re % (version_re, 'tracking-protection/start') content_blocking_re = latest_re % (version_re, 'content-blocking/start') platform_re = '(?Pandroid|ios)' @@ -71,7 +72,8 @@ url(r'^firefox/installer-help/$', views.installer_help, name='firefox.installer-help'), url(firstrun_re, views.FirstrunView.as_view(), name='firefox.firstrun'), - url(whatsnew_re, views.WhatsnewView.as_view(), name='firefox.whatsnew'), + url(whatsnew_re, views.WhatsNewRedirectorView.as_view(), name='firefox.whatsnew'), + url(whatsnew_re_all, views.WhatsnewView.as_view(), name='firefox.whatsnew.all'), url(tracking_protection_re, views.TrackingProtectionTourView.as_view(), name='firefox.tracking-protection-tour.start'), url(content_blocking_re, views.ContentBlockingTourView.as_view(), diff --git a/bedrock/firefox/views.py b/bedrock/firefox/views.py index 30937a24459..4e0de83a29e 100644 --- a/bedrock/firefox/views.py +++ b/bedrock/firefox/views.py @@ -35,6 +35,7 @@ from bedrock.newsletter.forms import NewsletterFooterForm from bedrock.releasenotes import version_re from bedrock.wordpress.views import BlogPostsView +from bedrock.base.views import GeoRedirectView UA_REGEXP = re.compile(r"Firefox/(%s)" % version_re) @@ -535,6 +536,17 @@ def get_template_names(self): return [template] +class WhatsNewRedirectorView(GeoRedirectView): + geo_urls = {} + default_url = 'firefox.whatsnew.all' + + def get_redirect_url(self, *args, **kwargs): + if 'version' in kwargs and kwargs['version'] is None: + del kwargs['version'] + + return super().get_redirect_url(*args, **kwargs) + + class WhatsnewView(l10n_utils.LangFilesMixin, TemplateView): def get_context_data(self, **kwargs): ctx = super(WhatsnewView, self).get_context_data(**kwargs) diff --git a/tests/pages/firefox/whatsnew.py b/tests/pages/firefox/whatsnew.py index 6454113d6ae..acd72d6639d 100644 --- a/tests/pages/firefox/whatsnew.py +++ b/tests/pages/firefox/whatsnew.py @@ -10,7 +10,7 @@ class FirefoxWhatsNewPage(FirefoxBasePage): - URL_TEMPLATE = '/{locale}/firefox/whatsnew/' + URL_TEMPLATE = '/{locale}/firefox/whatsnew/all/' _qr_code_locator = (By.CSS_SELECTOR, '.qr-code img')