don't do the contrib redirect if show_contrib is False (bug 640243)

This commit is contained in:
Jeff Balogh 2011-03-09 15:40:24 -08:00
Родитель 58b2f7a621
Коммит 54aa610b28
3 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -129,6 +129,7 @@ class InstallButton(object):
self.is_persona = addon.type == amo.ADDON_PERSONA
self.accept_eula = addon.has_eula and not show_eula
self._show_contrib = show_contrib
self.show_contrib = (show_contrib and addon.takes_contributions
and addon.annoying == amo.CONTRIB_ROADBLOCK)
self.show_eula = not self.show_contrib and show_eula and addon.has_eula
@ -161,7 +162,8 @@ class InstallButton(object):
def attrs(self):
rv = {}
addon = self.addon
if addon.takes_contributions and addon.annoying == amo.CONTRIB_AFTER:
if (self._show_contrib and addon.takes_contributions
and addon.annoying == amo.CONTRIB_AFTER):
rv['data-after'] = 'contrib'
if addon.type == amo.ADDON_SEARCH:
rv['data-search'] = 'true'

Просмотреть файл

@ -335,6 +335,15 @@ class TestButton(ButtonTest):
b = self.get_button()
eq_(b.attrs(), {'data-after': 'contrib', 'data-search': 'true'})
def test_after_no_show_contrib(self):
self.addon.takes_contributions = True
self.addon.annoying = amo.CONTRIB_AFTER
b = self.get_button()
eq_(b.attrs(), {'data-after': 'contrib'})
b = self.get_button(show_contrib=False)
eq_(b.attrs(), {})
def test_file_details(self):
file = self.get_file(amo.PLATFORM_ALL)
self.addon.meet_the_dev_url.return_value = 'meet.dev'

Просмотреть файл

@ -3886,7 +3886,6 @@ class TestAdmin(test_utils.TestCase):
def login_user(self):
assert self.client.login(username='del@icio.us', password='password')
x=1
def test_show_admin_settings_admin(self):
self.login_admin()
url = reverse('devhub.addons.edit', args=['a3615'])