From e6015d87a9d9cec3f12955617cd4c9d35ae594b4 Mon Sep 17 00:00:00 2001 From: Andy McKay Date: Thu, 16 Dec 2010 17:11:05 -0800 Subject: [PATCH] cancel as per (bug 617764) --- apps/devhub/templates/devhub/versions/list.html | 13 ++++++++++++- apps/devhub/tests/test_views.py | 11 ++++++----- apps/devhub/views.py | 8 ++++++-- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/apps/devhub/templates/devhub/versions/list.html b/apps/devhub/templates/devhub/versions/list.html index 4f3569e1ff..e6482357a6 100644 --- a/apps/devhub/templates/devhub/versions/list.html +++ b/apps/devhub/templates/devhub/versions/list.html @@ -188,8 +188,19 @@

{{ _('Cancel Review Request') }}

+ {% if addon.status == amo.STATUS_LITE_AND_NOMINATED %} + {% trans %} + Canceling your review request will leave your + add-on as preliminarily reviewed. + {% endtrans %} + {% else %} + {% trans %} + Canceling your review request will mark your add-on incomplete. + If you do not complete your add-on after several days + by re-requesting review, it will be deleted. + {% endtrans %} + {% endif %} {% trans %} - Canceling your review request will reset the addons status. If you'd prefer to have another version reviewed, simply upload the new version instead. {% endtrans %} diff --git a/apps/devhub/tests/test_views.py b/apps/devhub/tests/test_views.py index 81436600b2..853b93ed56 100644 --- a/apps/devhub/tests/test_views.py +++ b/apps/devhub/tests/test_views.py @@ -1814,13 +1814,14 @@ class TestVersion(test_utils.TestCase): def test_cancel(self): cancel_url = reverse('devhub.addons.cancel', args=[3615]) - for status in amo.STATUS_CHOICES: - if status not in amo.STATUS_UNDER_REVIEW: - continue + self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED) + self.client.post(cancel_url) + eq_(Addon.objects.get(id=3615).status, amo.STATUS_LITE) - self.addon.update(status=status, highest_status=amo.STATUS_BETA) + for status in (amo.STATUS_UNREVIEWED, amo.STATUS_NOMINATED): + self.addon.update(status=status) self.client.post(cancel_url) - eq_(Addon.objects.get(id=3615).status, amo.STATUS_BETA) + eq_(Addon.objects.get(id=3615).status, amo.STATUS_NULL) def test_not_cancel(self): self.client.logout() diff --git a/apps/devhub/views.py b/apps/devhub/views.py index 68c0b2fc63..12c08fedeb 100644 --- a/apps/devhub/views.py +++ b/apps/devhub/views.py @@ -270,9 +270,13 @@ def enable(request, addon_id, addon): @dev_required @owner_for_post_required def cancel(request, addon_id, addon): - if addon.is_under_review: - addon.update(status=addon.highest_status) + if addon.status in amo.STATUS_UNDER_REVIEW: + if addon.status == amo.STATUS_LITE_AND_NOMINATED: + addon.update(status=amo.STATUS_LITE) + else: + addon.update(status=amo.STATUS_NULL) amo.log(amo.LOG.CHANGE_STATUS, addon.get_status_display(), addon) + return redirect('devhub.versions', addon_id)