Skip to content

Commit

Permalink
Remove legacy firefox mobile template (Fixes mozilla#13039) (mozilla#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgibson committed Jul 31, 2023
1 parent 674b534 commit dfc0524
Show file tree
Hide file tree
Showing 38 changed files with 3 additions and 2,711 deletions.
25 changes: 0 additions & 25 deletions bedrock/firefox/templates/firefox/mobile/includes/s2d-hero.html

This file was deleted.

202 changes: 0 additions & 202 deletions bedrock/firefox/templates/firefox/mobile/index.html

This file was deleted.

31 changes: 0 additions & 31 deletions bedrock/firefox/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,37 +531,6 @@ def test_firefox_welcome_page1(self, render_mock):
render_mock.assert_called_once_with(req, "firefox/welcome/page1.html", ANY, ftl_files="firefox/welcome/page1")


@override_settings(DEV=False)
@patch("bedrock.firefox.views.l10n_utils.render", return_value=HttpResponse())
class TestFirefoxMobile(TestCase):
@patch.object(views, "ftl_file_is_active", lambda *x: True)
def test_landing_template(self, render_mock):
req = RequestFactory().get("/firefox/browsers/mobile/")
req.locale = "en-US"
view = views.FirefoxMobileView.as_view()
view(req)
template = render_mock.call_args[0][1]
assert template == ["firefox/browsers/mobile/index.html"]

@patch.object(views, "ftl_file_is_active", lambda *x: False)
def test_legacy_template(self, render_mock):
req = RequestFactory().get("/firefox/browsers/mobile/")
req.locale = "en-US"
view = views.FirefoxMobileView.as_view()
view(req)
template = render_mock.call_args[0][1]
assert template == ["firefox/mobile/index.html"]

@patch.object(views, "ftl_file_is_active", lambda *x: True)
def test_legacy_template_param(self, render_mock):
req = RequestFactory().get("/firefox/browsers/mobile/?xv=legacy")
req.locale = "en-US"
view = views.FirefoxMobileView.as_view()
view(req)
template = render_mock.call_args[0][1]
assert template == ["firefox/mobile/index.html"]


# Issue 13253: Ensure that Firefox can continue to refer to this URL.
class TestFirefoxSetAsDefaultThanks(TestCase):
def test_firefox_set_as_default_thanks(self):
Expand Down
2 changes: 1 addition & 1 deletion bedrock/firefox/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
ftl_files=["firefox/browsers/compare/safari", "firefox/browsers/compare/shared"],
),
# Issue 10182
path("firefox/browsers/mobile/", views.FirefoxMobileView.as_view(), name="firefox.browsers.mobile.index"),
page("firefox/browsers/mobile/", "firefox/browsers/mobile/index.html", ftl_files=["firefox/browsers/mobile/index"]),
page("firefox/browsers/mobile/android/", "firefox/browsers/mobile/android.html", ftl_files=["firefox/browsers/mobile/android"]),
page("firefox/browsers/mobile/ios/", "firefox/browsers/mobile/ios.html", ftl_files=["firefox/browsers/mobile/ios"]),
page("firefox/browsers/mobile/get-ios/", "firefox/browsers/mobile/get-ios.html", ftl_files=["firefox/browsers/mobile/get-ios"]),
Expand Down
21 changes: 0 additions & 21 deletions bedrock/firefox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,27 +951,6 @@ def firefox_features_translate(request):
return l10n_utils.render(request, template_name, context, ftl_files=["firefox/features/shared", "firefox/features/translate"])


class FirefoxMobileView(L10nTemplateView):
ftl_files_map = {
"firefox/mobile/index.html": ["firefox/mobile"],
"firefox/browsers/mobile/index.html": ["firefox/browsers/mobile/index"],
}
activation_files = [
"firefox/mobile",
"firefox/browsers/mobile/index",
]

def get_template_names(self):
experience = self.request.GET.get("xv", None)

if ftl_file_is_active("firefox/browsers/mobile/index") and experience != "legacy":
template = "firefox/browsers/mobile/index.html"
else:
template = "firefox/mobile/index.html"

return [template]


class FirefoxContentful(L10nTemplateView):
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
Expand Down
Loading

0 comments on commit dfc0524

Please sign in to comment.