Skip to content

Commit

Permalink
Decommission /firefox/feedback/ page (Fixes #7436)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgibson authored and Errolyn committed Aug 12, 2019
1 parent 2ff934c commit 9ba0468
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 500 deletions.
3 changes: 3 additions & 0 deletions bedrock/firefox/redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,4 +611,7 @@ def firefox_channel(*args, **kwargs):

# issue 7287
redirect(r'^accounts/?$', 'firefox.accounts'),

# issue 7436
redirect(r'^firefox/feedback/?$', 'https://support.mozilla.org/questions/new/desktop'),
)
81 changes: 0 additions & 81 deletions bedrock/firefox/templates/firefox/feedback/happy.html

This file was deleted.

65 changes: 0 additions & 65 deletions bedrock/firefox/templates/firefox/feedback/unhappy.html

This file was deleted.

39 changes: 0 additions & 39 deletions bedrock/firefox/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,45 +958,6 @@ def test_compare_edge_scene_1_non_us(self, render_mock):
)


class TestFeedbackView(TestCase):
def test_get_template_names_default_unhappy(self):
view = views.FeedbackView()
view.request = RequestFactory().get('/')
assert view.get_template_names() == ['firefox/feedback/unhappy.html']

def test_get_template_names_happy(self):
view = views.FeedbackView()
view.request = RequestFactory().get('/?score=5')
assert view.get_template_names() == ['firefox/feedback/happy.html']

def test_get_template_names_unhappy(self):
view = views.FeedbackView()
view.request = RequestFactory().get('/?score=1')
assert view.get_template_names() == ['firefox/feedback/unhappy.html']

def test_get_context_data_three_stars(self):
view = views.FeedbackView()
view.request = RequestFactory().get('/?score=3')

ctx = view.get_context_data()
self.assertTrue(ctx['donate_stars_url'].endswith('Heartbeat_3stars'))

def test_get_context_data_five_stars(self):
view = views.FeedbackView()
view.request = RequestFactory().get('/?score=5')

ctx = view.get_context_data()
self.assertTrue(ctx['donate_stars_url'].endswith('Heartbeat_5stars'))

def test_get_context_data_one_star(self):
"""donate_stars_url should be undefined"""
view = views.FeedbackView()
view.request = RequestFactory().get('/?score=1')

ctx = view.get_context_data()
self.assertFalse('donate_stars_url' in ctx)


class TestFirefoxConcerts(TestCase):
@override_settings(DEV=False)
@override_settings(SWITCH_FIREFOX_CONCERT_SERIES=False)
Expand Down
3 changes: 0 additions & 3 deletions bedrock/firefox/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@
url('^firefox/releases/$', bedrock.releasenotes.views.releases_index,
{'product': 'Firefox'}, name='firefox.releases.index'),

# Bug 1108828. Different templates for different URL params.
url('firefox/feedback/$', views.FeedbackView.as_view(), name='firefox.feedback'),

url('^firefox/stub_attribution_code/$', views.stub_attribution_code,
name='firefox.stub_attribution_code'),

Expand Down
30 changes: 0 additions & 30 deletions bedrock/firefox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,36 +643,6 @@ def get_template_names(self):
return [template]


class FeedbackView(TemplateView):

donate_url = (
'https://donate.mozilla.org/'
'?utm_source=Heartbeat_survey&utm_medium=referral'
'&utm_content=Heartbeat_{0}stars'
)

def get_score(self):
return self.request.GET.get('score', '0')

def get_template_names(self):
score = self.get_score()
if score > '3':
template = 'firefox/feedback/happy.html'
else:
template = 'firefox/feedback/unhappy.html'

return [template]

def get_context_data(self, **kwargs):
context = super(FeedbackView, self).get_context_data(**kwargs)
score = self.get_score()

if score in ['3', '4', '5']:
context['donate_stars_url'] = self.donate_url.format(score)

return context


class TrackingProtectionTourView(l10n_utils.LangFilesMixin, TemplateView):
def get_template_names(self):
variation = self.request.GET.get('variation', None)
Expand Down
Loading

0 comments on commit 9ba0468

Please sign in to comment.