From 5d37a9c1c62bdee38ca589ff3340908c5ae348e7 Mon Sep 17 00:00:00 2001 From: Andrew Williamson Date: Fri, 22 Jul 2016 18:05:58 +0100 Subject: [PATCH] bye bye preliminary - devhub --- src/olympia/addons/models.py | 5 - src/olympia/devhub/forms.py | 32 -- src/olympia/devhub/helpers.py | 29 +- src/olympia/devhub/tasks.py | 23 +- .../templates/devhub/addons/edit/basic.html | 2 - .../devhub/addons/submit/describe.html | 2 - .../templates/devhub/addons/submit/done.html | 10 +- .../devhub/addons/submit/select-review.html | 68 --- .../devhub/addons/submit/sidebar.html | 16 +- .../devhub/addons/submit/upload.html | 11 +- .../templates/devhub/email/submission.html | 4 - .../devhub/includes/addon_details.html | 27 - .../devhub/includes/version_file.html | 2 +- .../templates/devhub/validate_addon.html | 9 +- .../devhub/versions/add_file_modal.html | 9 +- .../templates/devhub/versions/edit.html | 2 +- .../templates/devhub/versions/list.html | 26 +- src/olympia/devhub/tests/test_helpers.py | 23 +- src/olympia/devhub/tests/test_tasks.py | 6 +- src/olympia/devhub/tests/test_utils.py | 4 +- src/olympia/devhub/tests/test_views.py | 487 ++---------------- src/olympia/devhub/tests/test_views_edit.py | 13 +- .../devhub/tests/test_views_validation.py | 23 +- .../devhub/tests/test_views_versions.py | 33 +- src/olympia/devhub/urls.py | 14 +- src/olympia/devhub/utils.py | 10 +- src/olympia/devhub/views.py | 120 +---- src/olympia/files/models.py | 2 +- src/olympia/signing/tests/test_views.py | 10 +- src/olympia/signing/views.py | 5 +- static/js/common/upload-addon.js | 20 +- 31 files changed, 148 insertions(+), 899 deletions(-) delete mode 100644 src/olympia/devhub/templates/devhub/addons/submit/select-review.html diff --git a/src/olympia/addons/models.py b/src/olympia/addons/models.py index 58adb1beaf..3956e09c6c 100644 --- a/src/olympia/addons/models.py +++ b/src/olympia/addons/models.py @@ -630,11 +630,6 @@ class Addon(OnChangeMixin, ModelBase): # with on a file-by-file basis. return not self.is_listed - @property - def is_sideload(self): - # An add-on can side-load if it has been fully reviewed. - return self.status in (amo.STATUS_NOMINATED, amo.STATUS_PUBLIC) - @amo.cached_property(writable=True) def listed_authors(self): return UserProfile.objects.filter( diff --git a/src/olympia/devhub/forms.py b/src/olympia/devhub/forms.py index 86a495d868..07cf2349de 100644 --- a/src/olympia/devhub/forms.py +++ b/src/olympia/devhub/forms.py @@ -11,7 +11,6 @@ from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _, ugettext_lazy as _lazy import commonware -import waffle from quieter_formset.formset import BaseModelFormSet from olympia.access import acl @@ -538,15 +537,6 @@ class NewAddonForm(AddonUploadForm): help_text=_lazy( u'Check this option if you intend to distribute your add-on on ' u'your own and only need it to be signed by Mozilla.')) - is_sideload = forms.BooleanField( - initial=False, - required=False, - label=_lazy(u'This add-on will be bundled with an application ' - u'installer.'), - help_text=_lazy(u'Add-ons that are bundled with application ' - u'installers will be code reviewed ' - u'by Mozilla before they are signed and are held to a ' - u'higher quality standard.')) def clean(self): if not self.errors: @@ -557,16 +547,6 @@ class NewAddonForm(AddonUploadForm): class NewVersionForm(NewAddonForm): - nomination_type = forms.TypedChoiceField( - choices=( - ('', ''), - (amo.STATUS_NOMINATED, _lazy('Full Review')), - (amo.STATUS_UNREVIEWED, _lazy('Preliminary Review')), - ), - coerce=int, empty_value=None, required=False, - error_messages={ - 'required': _lazy(u'Please choose a review nomination type') - }) beta = forms.BooleanField( required=False, help_text=_lazy(u'A file with a version ending with ' @@ -576,9 +556,6 @@ class NewVersionForm(NewAddonForm): def __init__(self, *args, **kw): self.addon = kw.pop('addon') super(NewVersionForm, self).__init__(*args, **kw) - if (not waffle.flag_is_active(self.request, 'no-prelim-review') and - self.addon.status == amo.STATUS_NULL): - self.fields['nomination_type'].required = True def clean(self): if not self.errors: @@ -697,15 +674,6 @@ FileFormSet = modelformset_factory(File, formset=BaseFileFormSet, form=FileForm, can_delete=True, extra=0) -class ReviewTypeForm(forms.Form): - _choices = [(k, Addon.STATUS_CHOICES[k]) for k in - (amo.STATUS_UNREVIEWED, amo.STATUS_NOMINATED)] - review_type = forms.TypedChoiceField( - choices=_choices, widget=forms.HiddenInput, - coerce=int, empty_value=None, - error_messages={'required': _lazy(u'A review type must be selected.')}) - - class Step3Form(AddonFormBasic): description = TransField(widget=TransTextarea, required=False) tags = None diff --git a/src/olympia/devhub/helpers.py b/src/olympia/devhub/helpers.py index 6e14c9f560..66ea2471c4 100644 --- a/src/olympia/devhub/helpers.py +++ b/src/olympia/devhub/helpers.py @@ -12,7 +12,6 @@ from olympia.amo.urlresolvers import reverse from olympia.amo.helpers import breadcrumbs, impala_breadcrumbs, page_title from olympia.access import acl from olympia.addons.helpers import new_context -from olympia.addons.models import Addon from olympia.devhub.models import ActivityLog from olympia.compat.models import CompatReport from olympia.files.models import File @@ -124,26 +123,9 @@ def source_form_field(field): return {'field': field} -@register.function -def status_choices(addon): - """ - Return a dict like File.STATUS_CHOICES customized for the addon status. - """ - # Show "awaiting full review" for unreviewed files on that track. - choices = dict(File.STATUS_CHOICES) - if addon.status in (amo.STATUS_NOMINATED, amo.STATUS_LITE_AND_NOMINATED, - amo.STATUS_PUBLIC): - choices[amo.STATUS_UNREVIEWED] = ( - Addon.STATUS_CHOICES[amo.STATUS_NOMINATED]) - elif addon.status in (amo.STATUS_UNREVIEWED, amo.STATUS_LITE): - choices[amo.STATUS_UNREVIEWED] = ( - Addon.STATUS_CHOICES[amo.STATUS_UNREVIEWED]) - return choices - - @register.inclusion_tag('devhub/versions/file_status_message.html') -def file_status_message(file, addon): - choices = status_choices(addon) +def file_status_message(file): + choices = File.STATUS_CHOICES return {'fileid': file.id, 'platform': file.get_platform_display(), 'created': datetime(file.created), 'status': choices[file.status], @@ -152,10 +134,10 @@ def file_status_message(file, addon): @register.function -def dev_files_status(files, addon): +def dev_files_status(files): """Group files by their status (and files per status).""" status_count = defaultdict(int) - choices = status_choices(addon) + choices = File.STATUS_CHOICES for file in files: status_count[file.status] += 1 @@ -168,12 +150,9 @@ def dev_files_status(files, addon): def status_class(addon): classes = { amo.STATUS_NULL: 'incomplete', - amo.STATUS_UNREVIEWED: 'unreviewed', amo.STATUS_NOMINATED: 'nominated', amo.STATUS_PUBLIC: 'fully-approved', amo.STATUS_DISABLED: 'admin-disabled', - amo.STATUS_LITE: 'lite', - amo.STATUS_LITE_AND_NOMINATED: 'lite-nom', amo.STATUS_DELETED: 'deleted', amo.STATUS_REJECTED: 'rejected', } diff --git a/src/olympia/devhub/tasks.py b/src/olympia/devhub/tasks.py index ae496a764b..7a4df6f92a 100644 --- a/src/olympia/devhub/tasks.py +++ b/src/olympia/devhub/tasks.py @@ -62,31 +62,25 @@ def validate(file_, listed=None, subtask=None): return result -def validate_and_submit(addon, file_, listed=None, - disallow_preliminary_review=False): +def validate_and_submit(addon, file_, listed=None): return validate( - file_, listed=listed, subtask=submit_file.si( - addon.pk, file_.pk, - disallow_preliminary_review=disallow_preliminary_review)) + file_, listed=listed, subtask=submit_file.si(addon.pk, file_.pk)) @task @write -def submit_file(addon_pk, upload_pk, disallow_preliminary_review=False): +def submit_file(addon_pk, upload_pk): addon = Addon.unfiltered.get(pk=addon_pk) upload = FileUpload.objects.get(pk=upload_pk) if upload.passed_all_validations: - create_version_for_upload( - addon, upload, - disallow_preliminary_review=disallow_preliminary_review) + create_version_for_upload(addon, upload) else: log.info('Skipping version creation for {upload_uuid} that failed ' 'validation'.format(upload_uuid=upload.uuid)) @atomic -def create_version_for_upload(addon, upload, - disallow_preliminary_review=False): +def create_version_for_upload(addon, upload): fileupload_exists = addon.fileupload_set.filter( created__gt=upload.created, version=upload.version).exists() version_exists = Version.unfiltered.filter( @@ -106,13 +100,8 @@ def create_version_for_upload(addon, upload, # The add-on's status will be STATUS_NULL when its first version is # created because the version has no files when it gets added and it # gets flagged as invalid. We need to manually set the status. - # TODO: Handle sideload add-ons. This assumes the user wants a prelim - # review since listed and sideload aren't supported for creation yet. if addon.status == amo.STATUS_NULL: - if disallow_preliminary_review: - addon.update(status=amo.STATUS_NOMINATED) - else: - addon.update(status=amo.STATUS_LITE) + addon.update(status=amo.STATUS_NOMINATED) auto_sign_version(version, is_beta=version.is_beta) diff --git a/src/olympia/devhub/templates/devhub/addons/edit/basic.html b/src/olympia/devhub/templates/devhub/addons/edit/basic.html index 5ba6323656..0d6d44a55a 100644 --- a/src/olympia/devhub/templates/devhub/addons/edit/basic.html +++ b/src/olympia/devhub/templates/devhub/addons/edit/basic.html @@ -67,7 +67,6 @@ {% endif %} - {% if waffle.flag('no-prelim-review') %} {{ tip(_("Experimental?"), @@ -81,7 +80,6 @@ _("This add-on is ready for general use.")) }} - {% endif %} {{ tip(_("Categories"), diff --git a/src/olympia/devhub/templates/devhub/addons/submit/describe.html b/src/olympia/devhub/templates/devhub/addons/submit/describe.html index a8ae1a7e1a..3fe5de2272 100644 --- a/src/olympia/devhub/templates/devhub/addons/submit/describe.html +++ b/src/olympia/devhub/templates/devhub/addons/submit/describe.html @@ -46,7 +46,6 @@ {% if addon.is_listed %} - {% if waffle.flag('no-prelim-review') %}
- {% endif %}
{{ cat_form.non_form_errors() }} diff --git a/src/olympia/devhub/templates/devhub/addons/submit/done.html b/src/olympia/devhub/templates/devhub/addons/submit/done.html index e65ced6930..0db3d8e1a8 100644 --- a/src/olympia/devhub/templates/devhub/addons/submit/done.html +++ b/src/olympia/devhub/templates/devhub/addons/submit/done.html @@ -8,9 +8,7 @@

{{ _("You're done!") }}

{% if addon.is_listed %}

- {% if addon.status == amo.STATUS_UNREVIEWED %} - {{ _('Your add-on has been submitted to the Preliminary Review queue.') }} - {% elif addon.status == amo.STATUS_NOMINATED %} + {% if addon.status == amo.STATUS_NOMINATED %} {{ _('Your add-on has been submitted to the Full Review queue.') }} {% endif %}

@@ -47,7 +45,7 @@

{% else %} - {% set signed = addon.status in [amo.STATUS_PUBLIC, amo.STATUS_LITE] %} + {% set signed = addon.status == amo.STATUS_PUBLIC %} {% if signed %}

{{ _('Your add-on has been signed and it\'s ready to use. You can download it here:') }} @@ -59,9 +57,7 @@

{% else %}

- {% if addon.status == amo.STATUS_UNREVIEWED %} - {{ _('Your add-on has been submitted to the Unlisted Preliminary Review queue.') }} - {% elif addon.status == amo.STATUS_NOMINATED %} + {% if addon.status == amo.STATUS_NOMINATED %} {{ _('Your add-on has been submitted to the Unlisted Full Review queue.') }} {% endif %}

diff --git a/src/olympia/devhub/templates/devhub/addons/submit/select-review.html b/src/olympia/devhub/templates/devhub/addons/submit/select-review.html deleted file mode 100644 index 602c823fd0..0000000000 --- a/src/olympia/devhub/templates/devhub/addons/submit/select-review.html +++ /dev/null @@ -1,68 +0,0 @@ -{% extends "devhub/addons/submit/base.html" %} - -{% set learn_more_url = 'https://developer.mozilla.org/en-US/Add-ons/AMO/Policy/Reviews' %} - -{% block title %}{{ dev_page_title(_('Step 6'), addon) }}{% endblock %} - -{% block primary %} -

{{ _('Step 6. Select a Review Process') }}

-

- {% trans %} - All add-ons hosted in our gallery must be reviewed by an editor before - they appear in categories or search results. While waiting for review, - your add-on can still be accessed through its direct URL. Please choose - the review process below that best fits your add-on. - {% endtrans %} -

-
- {{ csrf() }} - {{ review_type_form.non_field_errors() }} - {{ review_type_form.review_type }} - {{ review_type_form.review_type.errors }} -
-
-

{{ _('Full Review') }}

-

- {% trans url=learn_more_url %} - A complete review of your add-on's source and functionality. - Learn more… - {% endtrans %} -

-
    -
  • {{ _('Appropriate for polished add-ons') }}
  • -
  • {{ _('Required if add-on is bundled in an installer') }}
  • -
  • {{ _('Review should take place within 10 days') }}
  • -
  • {{ _('Review of subsequent versions within 5 days') }}
  • -
  • {{ _('Warning-free installation and no feature limitations') }}
  • -
-

- -

-
-
-
-
-

{{ _('Preliminary Review') }}

-

- {% trans url=learn_more_url %} - A faster review of your add-on's source for any major problems. - Learn more… - {% endtrans %} -

-
    -
  • {{ _('Appropriate for experimental add-ons') }}
  • -
  • {{ _('Review should take place within 3 days') }}
  • -
  • {{ _('Some feature limitations') }}
  • -
  • {{ _('Binary and obfuscated add-ons ineligible') }}
  • -
-

- -

-
-
-
-{% endblock %} diff --git a/src/olympia/devhub/templates/devhub/addons/submit/sidebar.html b/src/olympia/devhub/templates/devhub/addons/submit/sidebar.html index 93458e1c06..c3602a1b58 100644 --- a/src/olympia/devhub/templates/devhub/addons/submit/sidebar.html +++ b/src/olympia/devhub/templates/devhub/addons/submit/sidebar.html @@ -4,24 +4,14 @@ {# List of steps: (text, class). A class of 'all' means the step is relevant to listed or unlisted addons, a class of 'listed' means it's only relevant to listed addons, not unlisted ones. #} -{% if waffle.flag('no-prelim-review') %} - {% set NAV = ((_('Getting Started'), 'all'), +{% set NAV = ((_('Getting Started'), 'all'), (_('Upload your add-on'), 'all'), (_('Describe your add-on'), 'all'), (_('Add images'), 'listed'), (_('Select a license'), 'listed'), - (_('n/a'), 'hidden'), (_("You're done!"), 'all')) %} -{% else %} - {% set NAV = ((_('Getting Started'), 'all'), - (_('Upload your add-on'), 'all'), - (_('Describe your add-on'), 'all'), - (_('Add images'), 'listed'), - (_('Select a license'), 'listed'), - (_('Select a review process'), 'listed'), - (_("You're done!"), 'all')) %} -{% endif %} -{% set MAX = 7 %} + +{% set MAX = 6 %} {% set BASE = 'devhub.submit.%s' %}
diff --git a/src/olympia/devhub/templates/devhub/addons/submit/upload.html b/src/olympia/devhub/templates/devhub/addons/submit/upload.html index 1c69fb70f0..f26e123a1c 100644 --- a/src/olympia/devhub/templates/devhub/addons/submit/upload.html +++ b/src/olympia/devhub/templates/devhub/addons/submit/upload.html @@ -28,21 +28,12 @@ ? - {% if not waffle.flag('no-prelim-review') %} - - {% endif %}
+ data-upload-url-unlisted="{{ url('devhub.upload_unlisted') }}"> {{ new_addon_form.non_field_errors() }} diff --git a/src/olympia/devhub/templates/devhub/email/submission.html b/src/olympia/devhub/templates/devhub/email/submission.html index 5a751634da..8a65625811 100644 --- a/src/olympia/devhub/templates/devhub/email/submission.html +++ b/src/olympia/devhub/templates/devhub/email/submission.html @@ -1,8 +1,4 @@ -{% if full_review %}

Thanks for submitting your {{ app }} Add-on to addons.mozilla.org (AMO)! Your add-on has been added to the Full Review queue.

-{% else %} -

Thanks for submitting your {{ app }} Add-on to addons.mozilla.org (AMO)! Your add-on has been added to the Preliminary Review queue.

-{% endif %}

We will contact you if we need more information. After it is reviewed, you will receive an email notification and your add-on will appear in categories and search results. While awaiting review, your add-on can still be accessed and installed directly from its detail page:

diff --git a/src/olympia/devhub/templates/devhub/includes/addon_details.html b/src/olympia/devhub/templates/devhub/includes/addon_details.html index aa9b4d189d..d0d8e61cfe 100644 --- a/src/olympia/devhub/templates/devhub/includes/addon_details.html +++ b/src/olympia/devhub/templates/devhub/includes/addon_details.html @@ -26,16 +26,6 @@ {% elif addon.status == amo.STATUS_NULL %} {{ status_and_tip(addon, _('Please complete your add-on.'), url=url('devhub.submit.resume', addon.slug)) }} - {% elif addon.status == amo.STATUS_PENDING %} - {{ status_and_tip(addon, _('You will receive an email when the review is complete.')) }} - {% elif addon.status == amo.STATUS_UNREVIEWED %} - {{ status_and_tip(addon, - _("You will receive an email when the review is complete. Until " - "then, your add-on is not listed in our gallery but can be " - "accessed directly from its details page.") - if addon.is_listed else - _("You will receive an email when the review is " - "complete and your add-on is signed.")) }} {% elif addon.status == amo.STATUS_NOMINATED %} {{ status_and_tip(addon, _("You will receive an email when the review is complete. Until " @@ -57,23 +47,6 @@ "longer shown in our gallery. If you have any questions, " "please email amo-admins@mozilla.org."), url=(addon.get_dev_url('versions') + '#version-upload')) }} - {% elif addon.status == amo.STATUS_LITE %} - {{ status_and_tip(addon, - _("Your add-on is displayed in our gallery as experimental " - "and users are receiving automatic updates. Some features " - "are unavailable to your add-on.") - if addon.is_listed else - _('Your add-on has been signed.')) }} - {% elif addon.status == amo.STATUS_LITE_AND_NOMINATED %} - {{ status_and_tip(addon, - _("You will receive an email when the full review is complete. " - "Until then, your add-on is displayed in our gallery as " - "experimental and users are receiving automatic updates. " - "Some features are unavailable to your add-on.") - if addon.is_listed else - _("You will receive an email when the full review is " - "complete, making you able to bundle your add-on with an " - "application installer.")) }} {% endif %} diff --git a/src/olympia/devhub/templates/devhub/includes/version_file.html b/src/olympia/devhub/templates/devhub/includes/version_file.html index de82dbf4e2..9b3b5ab1fb 100644 --- a/src/olympia/devhub/templates/devhub/includes/version_file.html +++ b/src/olympia/devhub/templates/devhub/includes/version_file.html @@ -6,7 +6,7 @@ {{ file.size|filesizeformat }} {{ form.platform }} - {{ status_choices(addon)[file.status] }} + {{ choices[file.status] }} {{ form.DELETE }} diff --git a/src/olympia/devhub/templates/devhub/validate_addon.html b/src/olympia/devhub/templates/devhub/validate_addon.html index 8a987045ad..9cf5c12d56 100644 --- a/src/olympia/devhub/templates/devhub/validate_addon.html +++ b/src/olympia/devhub/templates/devhub/validate_addon.html @@ -47,20 +47,13 @@ ? - + data-upload-url-unlisted="{{ url('devhub.standalone_upload_unlisted') }}""> diff --git a/src/olympia/devhub/templates/devhub/versions/add_file_modal.html b/src/olympia/devhub/templates/devhub/versions/add_file_modal.html index e13a4115f9..62f41bb30c 100644 --- a/src/olympia/devhub/templates/devhub/versions/add_file_modal.html +++ b/src/olympia/devhub/templates/devhub/versions/add_file_modal.html @@ -1,7 +1,6 @@ - {% if not waffle.flag('no-prelim-review') and addon.status == amo.STATUS_NULL %} -
- - {{ new_file_form.nomination_type }} -
- {% endif %}
? diff --git a/src/olympia/devhub/templates/devhub/versions/edit.html b/src/olympia/devhub/templates/devhub/versions/edit.html index e1f68c4e81..4af98c0ad2 100644 --- a/src/olympia/devhub/templates/devhub/versions/edit.html +++ b/src/olympia/devhub/templates/devhub/versions/edit.html @@ -101,7 +101,7 @@
    {% for file in version.all_files %}
  • - {{ file_status_message(file, addon) }} + {{ file_status_message(file) }}
  • {% endfor %}
diff --git a/src/olympia/devhub/templates/devhub/versions/list.html b/src/olympia/devhub/templates/devhub/versions/list.html index 68ddb44548..ba2b8c06f5 100644 --- a/src/olympia/devhub/templates/devhub/versions/list.html +++ b/src/olympia/devhub/templates/devhub/versions/list.html @@ -17,7 +17,7 @@ - {% for count, status in dev_files_status(version.all_files, addon) %} + {% for count, status in dev_files_status(version.all_files) %}
{# L10n: {0} is the number of files #} {{ status }} ({{ ngettext('{0} file', '{0} files', count)|f(count) }}) @@ -77,22 +77,19 @@ x - {% set no_prelim = waffle.flag('no-prelim-review') %} - {% set request_reviews=addon.can_request_review(no_prelim) %} - {% set can_cancel=(not addon.is_disabled and addon.is_under_review) %} + {% set request_reviews=addon.can_request_review(disallow_preliminary_review=True) %} + {% set can_cancel=(not addon.is_disabled and addon.status==amo.STATUS_NOMINATED) %} {% 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'), - amo.STATUS_LITE: _('Request Preliminary Review')} %} {% for status in request_reviews %} {{ csrf() }} - · + · {% endfor %} {% if can_cancel %} @@ -364,23 +361,16 @@ {% endif %} - {% if not addon.is_disabled and addon.is_under_review %} + {% if not addon.is_disabled and addon.status == amo.STATUS_NOMINATED %}