block prelim addons from having contrib or beta (bug 612047)

This commit is contained in:
Jeff Balogh 2010-12-06 16:51:37 -08:00
Родитель 26900ffb05
Коммит b47e4575e5
40 изменённых файлов: 48 добавлений и 62 удалений

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

@ -32,7 +32,7 @@ class AddonAdmin(admin.ModelAdmin):
'fields': ('disabled_by_user', 'trusted', 'view_source',
'public_stats', 'prerelease', 'admin_review',
'site_specific', 'external_software', 'binary',
'dev_agreement', 'show_beta'),
'dev_agreement'),
}),
('Money', {
'fields': ('wants_contributions', 'paypal_id', 'suggested_amount',

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

@ -121,7 +121,6 @@
"developer_comments": null,
"disabled_by_user": false,
"average_daily_downloads": 14,
"show_beta": true,
"admin_review_type": 1,
"the_future": 1325265,
"trusted": false,

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

@ -121,7 +121,6 @@
"developer_comments": null,
"disabled_by_user": false,
"average_daily_downloads": 14,
"show_beta": true,
"admin_review_type": 1,
"the_future": 13252965,
"trusted": false,

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

@ -55,7 +55,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 28,
"show_beta": 1,
"the_future": null,
"trusted": 0,
"locale_disambiguation": null,

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

@ -12,7 +12,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 2,
"show_beta": 1,
"the_future": null,
"trusted": 0,
"locale_disambiguation": "",
@ -101,7 +100,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 39,
"show_beta": 1,
"the_future": null,
"trusted": 0,
"locale_disambiguation": "",
@ -155,7 +153,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 756,
"show_beta": 1,
"the_future": null,
"trusted": 1,
"locale_disambiguation": "",

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

@ -24,7 +24,6 @@
"total_downloads": 107,
"disabled_by_user": 0,
"average_daily_downloads": 10,
"show_beta": 1,
"the_future": null,
"trusted": 0,
"locale_disambiguation": null,

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

@ -20,7 +20,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 238,
"show_beta": 0,
"the_future": null,
"trusted": 0,
"locale_disambiguation": null,

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

@ -21,7 +21,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 1511,
"show_beta": 0,
"the_future": null,
"trusted": 0,
"locale_disambiguation": null,

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

@ -83,7 +83,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 0,
"show_beta": 1,
"the_future": null,
"trusted": 0,
"locale_disambiguation": null,

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

@ -41,7 +41,6 @@
"share_count": 16,
"admin_review": 0,
"average_daily_downloads": 19684,
"show_beta": 1,
"support_email": null,
"trusted": 1,
"average_rating": "3.98",
@ -95,7 +94,6 @@
"share_count": 16,
"admin_review": 0,
"average_daily_downloads": 19684,
"show_beta": 1,
"support_email": null,
"trusted": 1,
"average_rating": "3.98",
@ -148,7 +146,6 @@
"share_count": 16,
"admin_review": 0,
"average_daily_downloads": 19684,
"show_beta": 1,
"support_email": null,
"trusted": 1,
"average_rating": "3.98",

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

@ -12,7 +12,6 @@
"developer_comments": null,
"disabled_by_user": false,
"average_daily_downloads": 0,
"show_beta": true,
"admin_review_type": 1,
"the_future": null,
"trusted": true,

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

@ -167,7 +167,6 @@ class Addon(amo.models.ModelBase):
help_text="Does the add-on contain a binary?")
dev_agreement = models.BooleanField(default=False,
help_text="Has the dev agreement been signed?")
show_beta = models.BooleanField(default=True)
nomination_date = models.DateTimeField(null=True,
db_column='nominationdate')
@ -510,6 +509,10 @@ class Addon(amo.models.ModelBase):
# Attach sharing stats.
sharing.attach_share_counts(AddonShareCountTotal, 'addon', addon_dict)
@property
def show_beta(self):
return self.status == amo.STATUS_PUBLIC and self.current_beta_version
@amo.cached_property
def current_beta_version(self):
"""Retrieves the latest version of an addon, in the beta channel."""
@ -656,7 +659,8 @@ class Addon(amo.models.ModelBase):
@property
def takes_contributions(self):
# TODO(jbalogh): config.paypal_disabled
return self.wants_contributions and (self.paypal_id or self.charity_id)
return (self.status == amo.STATUS_PUBLIC and self.wants_contributions
and (self.paypal_id or self.charity_id))
@property
def has_eula(self):

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

@ -132,7 +132,7 @@
</div>{# /featured #}
{% if addon.description or previews|length > 1 or addon.developer_comments or
(addon.show_beta and addon.current_beta_version) %}
addon.show_beta %}
<h3 id="more-about">{{ _('More about this add-on') }}</h3>
<div class="article userinput">
{% if addon.id == 4664 or addon.id == 144983 %}
@ -160,7 +160,7 @@
{% endif %}
{# beta channel #}
{% if addon.show_beta and addon.current_beta_version %}
{% if addon.show_beta %}
<h4 id="beta-channel">{{ _('Beta Channel') }}</h4>
<div>
<p>

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

@ -46,8 +46,8 @@ class TestHelpers(test_utils.TestCase):
a = Addon(id=12)
eq_(support_addon(a), '')
# TODO(jbalogh): check the url when using reverse
a.wants_contributions = a.paypal_id = True
a.status = amo.STATUS_PUBLIC
eq_(PyQuery(support_addon(a))('a').text(), 'Support this add-on')
a.suggested_amount = '12'

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

@ -281,6 +281,41 @@ class TestAddonModels(test_utils.TestCase):
assert new_reply.pk not in review_list, (
'Developer reply must not show up in review list.')
def test_takes_contributions(self):
a = Addon(status=amo.STATUS_PUBLIC, wants_contributions=True,
paypal_id='$$')
assert a.takes_contributions
a.status = amo.STATUS_UNREVIEWED
assert not a.takes_contributions
a.status = amo.STATUS_PUBLIC
a.wants_contributions = False
assert not a.takes_contributions
a.wants_contributions = True
a.paypal_id = None
assert not a.takes_contributions
a.charity_id = 12
assert a.takes_contributions
def test_show_beta(self):
# Addon.current_beta_version will be empty, so show_beta is False.
a = Addon(status=amo.STATUS_PUBLIC)
assert not a.show_beta
@patch('addons.models.Addon.current_beta_version')
def test_show_beta_with_beta_version(self, beta_mock):
beta_mock.return_value = object()
# Fake current_beta_version to return something truthy.
a = Addon(status=amo.STATUS_PUBLIC)
assert a.show_beta
# We have a beta version but status has to be public.
a.status = amo.STATUS_UNREVIEWED
assert not a.show_beta
class TestCategoryModel(test_utils.TestCase):

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

@ -430,7 +430,6 @@ class TestDetailPage(test_utils.TestCase):
addon = Addon.objects.get(id=3615)
addon.developer_comments_id = None
addon.description_id = None
addon.show_beta = False
addon.previews.all().delete()
addon.save()
@ -452,12 +451,12 @@ class TestDetailPage(test_utils.TestCase):
mybetafile = myaddon.versions.all()[0].files.all()[0]
mybetafile.status = amo.STATUS_BETA
mybetafile.save()
myaddon.update(status=amo.STATUS_PUBLIC)
beta = get_pq_content()
eq_(beta('#beta-channel').length, 1)
# Now hide it.
myaddon.show_beta = False
myaddon.save()
# Now hide it. Beta is only shown for STATUS_PUBLIC.
myaddon.update(status=amo.STATUS_UNREVIEWED)
beta = get_pq_content()
eq_(beta('#beta-channel').length, 0)

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

@ -93,7 +93,6 @@
"developer_comments": null,
"disabled_by_user": false,
"average_daily_downloads": 2930,
"show_beta": true,
"admin_review_type": 1,
"guid": null,
"trusted": false,

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

@ -36,7 +36,6 @@
"total_downloads": 4396083,
"disabled_by_user": false,
"average_daily_downloads": 4155,
"show_beta": true,
"guid": "{d9284e50-81fc-11da-a72b-0800200c9a66}",
"trusted": false,
"locale_disambiguation": null,

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

@ -160,7 +160,6 @@
"developer_comments": 15003,
"disabled_by_user": false,
"average_daily_downloads": 5242,
"show_beta": true,
"guid": "{2fa4ed95-0317-4c6a-a74c-5f3e3912c1f9}",
"trusted": true,
"description": 15002,

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

@ -14,7 +14,6 @@
"developer_comments": null,
"disabled_by_user": true,
"average_daily_downloads": 1510,
"show_beta": false,
"guid": "{835A3F80-DF39-11D9-A0B5-000D0B3AEB26}",
"trusted": false,
"description": null,

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

@ -25,7 +25,6 @@
"developer_comments": null,
"disabled_by_user": false,
"average_daily_downloads": 38,
"show_beta": true,
"guid": "{7c07e56e-b2f0-4932-bbe2-857a91b69f45}",
"trusted": false,
"locale_disambiguation": null,

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

@ -46,7 +46,6 @@
"developer_comments": null,
"disabled_by_user": false,
"average_daily_downloads": 462,
"show_beta": true,
"guid": null,
"trusted": false,
"locale_disambiguation": null,

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

@ -103,7 +103,6 @@
"developer_comments": 4664,
"disabled_by_user": false,
"average_daily_downloads": 1278,
"show_beta": true,
"guid": "{1a0c9ebe-ddf9-4b76-b8a3-675c77874d37}",
"trusted": false,
"description": 38750,

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

@ -43,7 +43,6 @@
"total_downloads": 206990,
"disabled_by_user": false,
"average_daily_downloads": 207,
"show_beta": true,
"guid": "bettergcal@ginatrapani.org",
"trusted": false,
"description": 58812,

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

@ -24,7 +24,6 @@
"total_downloads": 1861589,
"disabled_by_user": false,
"average_daily_downloads": 1798,
"show_beta": true,
"guid": "yslow@yahoo-inc.com",
"trusted": false,
"locale_disambiguation": null,

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

@ -48,7 +48,6 @@
"total_downloads": 19521947,
"disabled_by_user": false,
"average_daily_downloads": 19502,
"show_beta": true,
"guid": "piclens@cooliris.com",
"trusted": true,
"description": null,

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

@ -31,7 +31,6 @@
"total_downloads": 5333900,
"disabled_by_user": 0,
"average_daily_downloads": 5476,
"show_beta": 1,
"guid": "{e968fc70-8f95-4ab9-9e79-304de2a71ee1}",
"trusted": 1,
"locale_disambiguation": null,

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

@ -42,7 +42,6 @@
"total_downloads": 169327,
"disabled_by_user": false,
"average_daily_downloads": 160,
"show_beta": true,
"guid": "{4c197c8f-a50f-4b49-a2d2-ed922c95612f}",
"trusted": true,
"locale_disambiguation": null,

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

@ -25,7 +25,6 @@
"developer_comments": null,
"disabled_by_user": false,
"average_daily_downloads": 786,
"show_beta": true,
"guid": "{22870005-adef-4c9d-ae36-d0e1f2f27e5a}",
"trusted": false,
"locale_disambiguation": null,

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

@ -25,7 +25,6 @@
"developer_comments": null,
"disabled_by_user": false,
"average_daily_downloads": 124,
"show_beta": true,
"guid": "{b1fad17a-3b98-c743-ed56-85c722d622d3}",
"trusted": false,
"locale_disambiguation": null,

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

@ -24,7 +24,6 @@
"total_downloads": 6539812,
"disabled_by_user": false,
"average_daily_downloads": 12201,
"show_beta": true,
"guid": "smarterwiki@wikiatic.com",
"trusted": false,
"locale_disambiguation": null,

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

@ -78,7 +78,6 @@
"developer_comments": 558043,
"disabled_by_user": 0,
"average_daily_downloads": 158,
"show_beta": 1,
"guid": "toolbar@sape.ru",
"trusted": 0,
"locale_disambiguation": null,

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

@ -37,7 +37,6 @@
"total_downloads": 0,
"disabled_by_user": 0,
"view_source": 0,
"show_beta": 1,
"guid": null,
"trusted": 0,
"binary": 0,
@ -162,7 +161,6 @@
"total_downloads": 446919,
"disabled_by_user": 0,
"average_daily_downloads": 750,
"show_beta": 1,
"guid": "quickdrag@mozilla.ktechcomputing.com",
"trusted": 0,
"locale_disambiguation": null,
@ -210,7 +208,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 4002,
"show_beta": 1,
"guid": "isreaditlater@ideashower.com",
"trusted": 1,
"locale_disambiguation": null,
@ -256,7 +253,6 @@
"total_downloads": 6536054,
"disabled_by_user": 0,
"average_daily_downloads": 7487,
"show_beta": 1,
"guid": "foxyproxy@eric.h.jung",
"trusted": 1,
"locale_disambiguation": null,
@ -303,7 +299,6 @@
"total_downloads": 2142245,
"disabled_by_user": 0,
"average_daily_downloads": 2477,
"show_beta": 1,
"guid": "{D2A6A719-7CBC-4594-85FD-C36AD881424F}",
"trusted": 1,
"locale_disambiguation": null,
@ -474,7 +469,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 3,
"show_beta": 1,
"guid": "limon@mbd",
"trusted": 0,
"locale_disambiguation": null,

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

@ -119,7 +119,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 20,
"show_beta": 1,
"the_future": null,
"trusted": 0,
"locale_disambiguation": null,

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

@ -51,7 +51,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 4380,
"show_beta": 1,
"guid": "bettergmail2@ginatrapani.org",
"trusted": 0,
"locale_disambiguation": null,

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

@ -12,7 +12,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 9,
"show_beta": 0,
"the_future": null,
"trusted": 0,
"locale_disambiguation": null,

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

@ -57,7 +57,6 @@
"total_downloads": 683268,
"disabled_by_user": 0,
"average_daily_downloads": 732,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "",
"binary": 0,
@ -101,7 +100,6 @@
"total_downloads": 14853651,
"disabled_by_user": 0,
"average_daily_downloads": 15920,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "",
"binary": 0,
@ -143,7 +141,6 @@
"total_downloads": 39300,
"disabled_by_user": 0,
"average_daily_downloads": 51,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "myspell",
"binary": 0,
@ -187,7 +184,6 @@
"total_downloads": 167176,
"disabled_by_user": 0,
"average_daily_downloads": 361,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "",
"binary": 0,
@ -231,7 +227,6 @@
"total_downloads": 17448,
"disabled_by_user": 0,
"average_daily_downloads": 43,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "AVL",
"binary": 0,
@ -275,7 +270,6 @@
"total_downloads": 17466,
"disabled_by_user": 0,
"average_daily_downloads": 19,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "",
"binary": 0,
@ -319,7 +313,6 @@
"total_downloads": 4531,
"disabled_by_user": 0,
"average_daily_downloads": 9,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "",
"binary": 0,
@ -363,7 +356,6 @@
"total_downloads": 8990,
"disabled_by_user": 0,
"average_daily_downloads": 23,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "AVL",
"binary": 0,
@ -407,7 +399,6 @@
"total_downloads": 4278,
"disabled_by_user": 0,
"average_daily_downloads": 12,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "AVL",
"binary": 0,
@ -452,7 +443,6 @@
"total_downloads": 71,
"disabled_by_user": 0,
"average_daily_downloads": 2,
"show_beta": 1,
"trusted": 0,
"locale_disambiguation": "",
"binary": 0,

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

@ -169,7 +169,6 @@
"developer_comments": null,
"disabled_by_user": false,
"average_daily_downloads": 76298,
"show_beta": true,
"the_future": null,
"trusted": true,
"locale_disambiguation": null,

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

@ -28,7 +28,6 @@
"developer_comments": null,
"disabled_by_user": 0,
"average_daily_downloads": 18166,
"show_beta": 1,
"the_future": null,
"trusted": 0,
"locale_disambiguation": null,

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

@ -76,7 +76,6 @@
"total_downloads": 24333,
"disabled_by_user": 0,
"average_daily_downloads": 75,
"show_beta": 1,
"guid": null,
"trusted": 0,
"locale_disambiguation": null,