diff --git a/apps/addons/models.py b/apps/addons/models.py index 6381e5910d6..562f6dd8f67 100644 --- a/apps/addons/models.py +++ b/apps/addons/models.py @@ -6,7 +6,6 @@ import posixpath import re import time -from datetime import datetime, timedelta from django.conf import settings from django.core.cache import cache @@ -1180,35 +1179,11 @@ def can_request_review(self): return () elif self.status == amo.STATUS_NOMINATED: return (amo.STATUS_LITE,) - elif self.status == amo.STATUS_UNREVIEWED: + elif self.status in [amo.STATUS_UNREVIEWED, amo.STATUS_LITE]: return (amo.STATUS_PUBLIC,) - elif self.status == amo.STATUS_LITE: - if self.days_until_full_nomination() == 0: - return (amo.STATUS_PUBLIC,) - else: - # Still in preliminary waiting period... - return () else: return (amo.STATUS_LITE, amo.STATUS_PUBLIC) - def days_until_full_nomination(self): - """Returns number of days until author can request full review. - - If wait period is over or this doesn't apply at all, returns 0 days. - An author must wait 10 days after submitting first LITE approval - to request FULL. - """ - if self.status != amo.STATUS_LITE: - return 0 - # Calculate wait time from the earliest submitted version: - qs = (File.objects.filter(version__addon=self, status=self.status) - .order_by('created').values_list('datestatuschanged'))[:1] - if qs: - days_ago = datetime.now() - qs[0][0] - if days_ago < timedelta(days=10): - return 10 - days_ago.days - return 0 - def is_persona(self): return self.type == amo.ADDON_PERSONA diff --git a/apps/addons/tests/test_models.py b/apps/addons/tests/test_models.py index a518106459d..db7ea2e0319 100644 --- a/apps/addons/tests/test_models.py +++ b/apps/addons/tests/test_models.py @@ -1174,60 +1174,6 @@ def test_update_logs(self): entries = ActivityLog.objects.all() eq_(entries[0].action, amo.LOG.CHANGE_STATUS.id) - def test_can_request_review_waiting_period(self): - now = datetime.now() - a = Addon.objects.create(type=1) - v = Version.objects.create(addon=a) - # The first LITE version is only 5 days old, no dice. - first_f = File.objects.create(status=amo.STATUS_LITE, version=v) - first_f.update(datestatuschanged=now - timedelta(days=5), - created=now - timedelta(days=20)) - # TODO(andym): can this go in Addon.objects.create? bug 618444 - a.update(status=amo.STATUS_LITE) - eq_(a.can_request_review(), ()) - - # Now the first LITE is > 10 days old, change can happen. - first_f.update(datestatuschanged=now - timedelta(days=11)) - # Add a second file, to be sure that we test the date - # of the first created file. - second_f = File.objects.create(status=amo.STATUS_LITE, version=v) - second_f.update(datestatuschanged=now - timedelta(days=5)) - eq_(a.status, amo.STATUS_LITE) - eq_(a.can_request_review(), (amo.STATUS_PUBLIC,)) - - def test_days_until_full_nomination(self): - # Normalize to 12am for reliable day subtraction: - now = datetime.now().date() - a = Addon.objects.create(type=1) - v = Version.objects.create(addon=a) - f = File.objects.create(status=amo.STATUS_LITE, version=v) - a.update(status=amo.STATUS_LITE) - f.update(datestatuschanged=now - timedelta(days=4)) - eq_(a.days_until_full_nomination(), 6) - - f.update(datestatuschanged=now - timedelta(days=1)) - eq_(a.days_until_full_nomination(), 9) - - f.update(datestatuschanged=now - timedelta(days=10)) - eq_(a.days_until_full_nomination(), 0) - - f.update(datestatuschanged=now) - eq_(a.days_until_full_nomination(), 10) - - # Only calculate days from first submitted version: - f.update(datestatuschanged=now - timedelta(days=2), - created=now - timedelta(days=2)) - # Ignore this one: - f2 = File.objects.create(status=amo.STATUS_LITE, version=v) - f2.update(datestatuschanged=now - timedelta(days=1), - created=now - timedelta(days=1)) - eq_(a.days_until_full_nomination(), 8) - - # Wrong status: - f.update(datestatuschanged=now - timedelta(days=4)) - a.update(status=amo.STATUS_PUBLIC) - eq_(a.days_until_full_nomination(), 0) - def setup_files(self, status): addon = Addon.objects.create(type=1) version = Version.objects.create(addon=addon) diff --git a/apps/devhub/templates/devhub/versions/list.html b/apps/devhub/templates/devhub/versions/list.html index fa449baec97..fd321bb6cad 100644 --- a/apps/devhub/templates/devhub/versions/list.html +++ b/apps/devhub/templates/devhub/versions/list.html @@ -65,9 +65,8 @@ {% set request_reviews=addon.can_request_review() %} - {% set days = addon.days_until_full_nomination() %} {% set can_cancel=(not addon.is_disabled and addon.is_under_review) %} - {% if full_info and check_addon_ownership(request, addon, dev=True) and (request_reviews or days or can_cancel) %} + {% if full_info and check_addon_ownership(request, addon, dev=True) and (request_reviews or can_cancel) %} {% set req = {amo.STATUS_PUBLIC: _('Request Full Review'), @@ -79,11 +78,6 @@ · {% endfor %} - {% if days != 0 %} - {{ ngettext('Full nomination will be available in {0} day', - 'Full nomination will be available in {0} days', - days)|f(days) }} - {% endif %} {% if can_cancel %} {{ _('Cancel Review Request') }} {% endif %} diff --git a/apps/devhub/tests/test_views_versions.py b/apps/devhub/tests/test_views_versions.py index 35c48967d6f..dc02d1aa387 100644 --- a/apps/devhub/tests/test_views_versions.py +++ b/apps/devhub/tests/test_views_versions.py @@ -1,5 +1,4 @@ import re -from datetime import datetime, timedelta import mock from nose.tools import eq_ @@ -415,14 +414,6 @@ def test_rejected_request_review(self): buttons = doc('.version-status-actions form button').text() eq_(buttons, None) - def test_days_until_full_nomination(self): - f = File.objects.create(status=amo.STATUS_LITE, version=self.version) - f.update(datestatuschanged=datetime.now() - timedelta(days=4)) - self.addon.update(status=amo.STATUS_LITE) - doc = pq(self.client.get(self.url).content) - eq_(doc('.version-status-actions .warning').text(), - 'Full nomination will be available in 6 days') - def test_add_version_modal(self): r = self.client.get(self.url) eq_(r.status_code, 200)