inform users about changes to desktop installs (bug 797646)

This commit is contained in:
Chris Van 2012-10-04 12:06:37 -07:00
Родитель 2941c53c74
Коммит 0619cd4245
3 изменённых файлов: 20 добавлений и 9 удалений

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

@ -35,7 +35,8 @@ class DevMailerForm(happyforms.Form):
('sdk', 'Developers of active SDK add-ons'),
('apps', 'Developers of active apps (not add-ons)'),
('payments',
'Developers of active apps (not add-ons) with payments')]
'Developers of active apps (not add-ons) with payments'),
('desktop_apps', 'Developers of active apps for desktop only')]
recipients = forms.ChoiceField(choices=_choices, required=True)
subject = forms.CharField(widget=forms.TextInput(attrs=dict(size='100')),
required=True)

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

@ -19,7 +19,6 @@ import amo.tests
from amo.tests import (formset, initial, close_to_now, assert_required,
assert_no_validation_errors)
from access.models import Group, GroupUser
from addons.cron import reindex_addons
from addons.models import Addon, CompatOverride, CompatOverrideRange
from amo.urlresolvers import reverse
from amo.utils import urlparams
@ -1866,13 +1865,6 @@ class TestElastic(amo.tests.ESTestCase):
self.refresh()
eq_(list(Addon.search()), list(Addon.objects.all()))
def test_recreate_index(self):
eq_(list(Addon.search()), [])
self.client.post(self.url, {'recreate': 'addons'})
self.client.post(self.url, {'reindex': 'addons'})
self.refresh()
eq_(list(Addon.search()), list(Addon.objects.all()))
class TestEmailDevs(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
@ -1938,6 +1930,21 @@ class TestEmailDevs(amo.tests.TestCase):
self.assertNoFormErrors(res)
eq_(len(mail.outbox), 1)
def test_only_desktop_apps(self):
from addons.models import AddonDeviceType
self.addon.update(type=amo.ADDON_WEBAPP)
AddonDeviceType.objects.create(addon=self.addon,
device_type=amo.DEVICE_MOBILE.id)
res = self.post(recipients='desktop_apps')
self.assertNoFormErrors(res)
eq_(len(mail.outbox), 0)
AddonDeviceType.objects.create(addon=self.addon,
device_type=amo.DEVICE_DESKTOP.id)
res = self.post(recipients='desktop_apps')
self.assertNoFormErrors(res)
eq_(len(mail.outbox), 1)
def test_only_apps(self):
self.addon.update(type=amo.ADDON_WEBAPP)
res = self.post(recipients='apps')

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

@ -634,6 +634,9 @@ def email_devs(request):
amo.ADDON_OTHER_INAPP))
elif data['recipients'] == 'apps':
qs = qs.filter(addon__type=amo.ADDON_WEBAPP)
elif data['recipients'] == 'desktop_apps':
qs = (qs.filter(addon__type=amo.ADDON_WEBAPP,
addon__addondevicetype__device_type=amo.DEVICE_DESKTOP.id))
elif data['recipients'] == 'sdk':
qs = qs.exclude(addon__versions__files__jetpack_version=None)
else: