Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/olympia/devhub/templates/devhub/addons/submit/describe.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,15 @@ <h3>{{ _('Describe Add-on') }}</h3>
</label>
<div class="source-submission-note">
<p>{{ _('Is there anything our reviewers should bear in mind when reviewing this add-on?') }}</p>
{% if sources_provided %}
<p>
<span class="req">{{ _('Remember') }}</span>:
{% trans policy_requirements_open='<a href="https://extensionworkshop.com/documentation/publish/source-code-submission/?utm_source=addons.mozilla.org&utm_medium=devhub&utm_content=submission-flow">'|safe, policy_requirements_close='</a>'|safe %}
If you submitted source code, but did not include instructions, you must provide them here.
Enter step-by-step build instructions to create an exact copy of the add-on code, per
{{ policy_requirements_open }}policy requirements{{ policy_requirements_close }}.
{%- endtrans -%}
</p>
{% endif %}
<p>
<span class="req">{{ _('Important') }}</span>:
{% trans policy_requirements_open='<a href="https://extensionworkshop.com/documentation/publish/source-code-submission/?utm_source=addons.mozilla.org&utm_medium=devhub&utm_content=submission-flow">'|safe, policy_requirements_close='</a>'|safe %}
Read our {{ policy_requirements_open }}policy requirements{{ policy_requirements_close }}
regarding build processes and source code submission. If your submission requires source
code, you must provide step-by-step build instructions, either inside the source code
package or here, that will create an exact copy of the code.
{%- endtrans -%}
</p>
</div>
{{ reviewer_form.approval_notes.errors }}
{{ reviewer_form.approval_notes }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ <h3>{{ _('Describe Version') }}</h3>
</label>
<div class="source-submission-note">
<p>{{ _('Is there anything our reviewers should bear in mind when reviewing this add-on?') }}</p>
{% if sources_provided %}
<p>
<span class="req">{{ _('Remember') }}</span>:
{% trans policy_requirements_open='<a href="https://extensionworkshop.com/documentation/publish/source-code-submission/?utm_source=addons.mozilla.org&utm_medium=devhub&utm_content=submission-flow">'|safe, policy_requirements_close='</a>'|safe %}
If you submitted source code, but did not include instructions, you must provide them here.
Enter step-by-step build instructions to create an exact copy of the add-on code, per
{{ policy_requirements_open }}policy requirements{{ policy_requirements_close }}.
{%- endtrans -%}
</p>
{% endif %}
<p>
<span class="req">{{ _('Important') }}</span>:
{% trans policy_requirements_open='<a href="https://extensionworkshop.com/documentation/publish/source-code-submission/?utm_source=addons.mozilla.org&utm_medium=devhub&utm_content=submission-flow">'|safe, policy_requirements_close='</a>'|safe %}
Read our {{ policy_requirements_open }}policy requirements{{ policy_requirements_close }}
regarding build processes and source code submission. If your submission requires source
code, you must provide step-by-step build instructions, either inside the source code
package or here, that will create an exact copy of the code.
{%- endtrans -%}
</p>
</div>
{{ reviewer_form.approval_notes.errors }}
{{ reviewer_form.approval_notes }}
Expand Down
66 changes: 24 additions & 42 deletions src/olympia/devhub/tests/test_views_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,7 @@ def test_success_listed(self):
version = addon.find_latest_version(channel=amo.CHANNEL_LISTED)
assert version
assert version.channel == amo.CHANNEL_LISTED
self.assert3xx(
response, reverse('devhub.submit.source', args=[addon.slug, 'listed'])
)
self.assert3xx(response, reverse('devhub.submit.details', args=[addon.slug]))
log_items = ActivityLog.objects.for_addons(addon)
assert log_items.filter(action=amo.LOG.CREATE_ADDON.id), (
'New add-on creation never logged.'
Expand All @@ -641,9 +639,7 @@ def test_success_custom_user_agent(self):
version = addon.find_latest_version(channel=amo.CHANNEL_LISTED)
assert version
assert version.channel == amo.CHANNEL_LISTED
self.assert3xx(
response, reverse('devhub.submit.source', args=[addon.slug, 'listed'])
)
self.assert3xx(response, reverse('devhub.submit.details', args=[addon.slug]))
log_items = ActivityLog.objects.for_addons(addon)
assert log_items.filter(action=amo.LOG.CREATE_ADDON.id), (
'New add-on creation never logged.'
Expand Down Expand Up @@ -944,7 +940,7 @@ def test_recaptcha_enabled_success(self):
)
addon = Addon.unfiltered.get()
self.assert3xx(
post_response, reverse('devhub.submit.source', args=[addon.slug, 'listed'])
post_response, reverse('devhub.submit.details', args=[addon.slug])
)

@override_switch('developer-submit-addon-captcha', active=True)
Expand All @@ -970,7 +966,7 @@ def setUp(self):
super().setUp()
assert not self.get_version().source
self.url = reverse('devhub.submit.source', args=[self.addon.slug, 'listed'])
self.next_url = reverse('devhub.submit.details', args=[self.addon.slug])
self.next_url = reverse('devhub.submit.finish', args=[self.addon.slug])

def post(self, has_source, source, expect_errors=False, status_code=200):
data = {
Expand Down Expand Up @@ -1482,7 +1478,7 @@ def setUp(self):

cat_form = self.client.get(self.url).context['cat_form']
self.cat_initial = initial(cat_form)
self.next_step = reverse('devhub.submit.finish', args=['a3615'])
self.next_step = reverse('devhub.submit.source', args=['a3615', 'unlisted'])
License.objects.create(builtin=3)

addon.current_version.file.update(status=amo.STATUS_AWAITING_REVIEW)
Expand Down Expand Up @@ -1747,31 +1743,14 @@ def test_set_privacy_nomsg(self):
self.get_addon().update(eula=None, privacy_policy=None)
self.is_success(self.get_dict(has_priv=True))

def test_source_submission_notes_not_shown_by_default(self):
url = reverse('devhub.submit.source', args=[self.addon.slug, 'listed'])
response = self.client.post(url, {'has_source': 'no'}, follow=True)

assert response.status_code == 200

doc = pq(response.content)
assert 'Remember: ' not in doc('.source-submission-note').text()

def test_source_submission_notes_shown(self):
url = reverse('devhub.submit.source', args=[self.addon.slug, 'listed'])

response = self.client.post(
url,
{
'has_source': 'yes',
'source': self.generate_source_zip(),
},
follow=True,
)
def test_source_submission_notes_always_shown(self):
url = reverse('devhub.submit.details', args=[self.addon.slug])
response = self.client.post(url)

assert response.status_code == 200

doc = pq(response.content)
assert 'Remember: ' in doc('.source-submission-note').text()
assert 'Important: ' in doc('.source-submission-note').text()


class TestStaticThemeSubmitDetails(DetailsPageMixin, TestSubmitBase):
Expand All @@ -1795,7 +1774,7 @@ def setUp(self):
category_id=CATEGORIES[amo.ADDON_EXTENSION]['social-communication'].id,
).delete()

self.next_step = reverse('devhub.submit.finish', args=['a3615'])
self.next_step = reverse('devhub.submit.source', args=['a3615', 'unlisted'])
License.objects.create(builtin=LICENSE_CC_COPYRIGHT.builtin)

addon.current_version.file.update(status=amo.STATUS_AWAITING_REVIEW)
Expand Down Expand Up @@ -2218,7 +2197,7 @@ def test_listed_last_uses_listed_upload(self, _submit_upload_mock):
assert args[1:] == (
self.addon,
amo.CHANNEL_LISTED,
'devhub.submit.version.source',
'devhub.submit.version.details',
)

@mock.patch('olympia.devhub.views._submit_upload', side_effect=views._submit_upload)
Expand All @@ -2230,7 +2209,7 @@ def test_unlisted_last_uses_unlisted_upload(self, _submit_upload_mock):
assert args[1:] == (
self.addon,
amo.CHANNEL_UNLISTED,
'devhub.submit.version.source',
'devhub.submit.version.details',
)

def test_no_versions_redirects_to_distribution(self):
Expand Down Expand Up @@ -2298,7 +2277,7 @@ def post(

def get_next_url(self, version):
return reverse(
'devhub.submit.version.source', args=[self.addon.slug, version.pk]
'devhub.submit.version.details', args=[self.addon.slug, version.pk]
)

def test_missing_compatibility_apps(self):
Expand Down Expand Up @@ -2713,7 +2692,10 @@ def test_langpack_requires_permission(self):

self.assert3xx(
response,
reverse('devhub.submit.version.source', args=[self.addon.slug, version.pk]),
reverse(
'devhub.submit.version.details',
args=[self.addon.slug, version.pk],
),
)

def test_redirect_if_addon_is_invisible(self):
Expand Down Expand Up @@ -2850,7 +2832,7 @@ def setUp(self):
'devhub.submit.version.source', args=[addon.slug, self.version.pk]
)
self.next_url = reverse(
'devhub.submit.version.details', args=[addon.slug, self.version.pk]
'devhub.submit.version.finish', args=[addon.slug, self.version.pk]
)
assert not self.get_version().source

Expand All @@ -2877,7 +2859,7 @@ def test_submit_empty_is_okay(self):
self.assert3xx(
response,
reverse(
'devhub.submit.version.finish', args=[self.addon.slug, self.version.pk]
'devhub.submit.version.source', args=[self.addon.slug, self.version.pk]
),
)

Expand All @@ -2900,7 +2882,7 @@ def test_submit_success(self):
self.assert3xx(
response,
reverse(
'devhub.submit.version.finish', args=[self.addon.slug, self.version.pk]
'devhub.submit.version.source', args=[self.addon.slug, self.version.pk]
),
)

Expand All @@ -2918,7 +2900,7 @@ def test_submit_details_unlisted_should_redirect(self):
self.assert3xx(
response,
reverse(
'devhub.submit.version.finish', args=[self.addon.slug, self.version.pk]
'devhub.submit.version.source', args=[self.addon.slug, self.version.pk]
),
)

Expand Down Expand Up @@ -2950,7 +2932,7 @@ def test_public_addon_stays_public_even_if_had_missing_metadata(self):
self.assert3xx(
response,
reverse(
'devhub.submit.version.finish', args=[self.addon.slug, self.version.pk]
'devhub.submit.version.source', args=[self.addon.slug, self.version.pk]
),
)
self.addon.reload()
Expand All @@ -2965,7 +2947,7 @@ def test_submit_static_theme_should_redirect(self):
self.assert3xx(
response,
reverse(
'devhub.submit.version.finish', args=[self.addon.slug, self.version.pk]
'devhub.submit.version.source', args=[self.addon.slug, self.version.pk]
),
)

Expand All @@ -2988,7 +2970,7 @@ def setUp(self):
'devhub.submit.version.details', args=['a3615', self.version.pk]
)
self.next_step = reverse(
'devhub.submit.version.finish', args=['a3615', self.version.pk]
'devhub.submit.version.source', args=['a3615', self.version.pk]
)


Expand Down
35 changes: 17 additions & 18 deletions src/olympia/devhub/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1616,7 +1616,7 @@ def _submit_upload(
client_info=request.META.get('HTTP_USER_AGENT'),
)
version = addon.find_latest_version(channel=channel)
url_args = [addon.slug, channel_text]
url_args = [addon.slug]
statsd.incr(f'devhub.submission.addon.{channel_text}')

check_validation_override(request, form, addon, version)
Expand Down Expand Up @@ -1709,7 +1709,7 @@ def submit_addon_upload(request, channel):
return redirect('devhub.submit.agreement')
channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel]
return _submit_upload(
request, None, channel_id, 'devhub.submit.source', include_recaptcha=True
request, None, channel_id, 'devhub.submit.details', include_recaptcha=True
)


Expand All @@ -1719,7 +1719,7 @@ def submit_theme_upload(request, channel):
return redirect('devhub.submit.theme.agreement')
channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel]
return _submit_upload(
request, None, channel_id, 'devhub.submit.source', theme_specific=True
request, None, channel_id, 'devhub.submit.details', theme_specific=True
)


Expand All @@ -1730,7 +1730,7 @@ def submit_version_upload(request, addon_id, addon, channel):
if not RestrictionChecker(request=request).is_submission_allowed():
return redirect('devhub.submit.version.agreement', addon.slug)
channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel]
return _submit_upload(request, addon, channel_id, 'devhub.submit.version.source')
return _submit_upload(request, addon, channel_id, 'devhub.submit.version.details')


@dev_required(submitting=True)
Expand All @@ -1747,7 +1747,7 @@ def submit_version_auto(request, addon_id, addon):
):
return redirect('devhub.submit.version.distribution', addon.slug)
channel = last_version.channel
return _submit_upload(request, addon, channel, 'devhub.submit.version.source')
return _submit_upload(request, addon, channel, 'devhub.submit.version.details')


@login_required
Expand All @@ -1756,7 +1756,7 @@ def submit_addon_theme_wizard(request, channel):
return redirect('devhub.submit.agreement')
channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel]
return _submit_upload(
request, None, channel_id, 'devhub.submit.source', wizard=True
request, None, channel_id, 'devhub.submit.details', wizard=True
)


Expand All @@ -1767,7 +1767,7 @@ def submit_version_theme_wizard(request, addon_id, addon, channel):
return redirect('devhub.submit.version.agreement', addon.slug)
channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel]
return _submit_upload(
request, addon, channel_id, 'devhub.submit.version.source', wizard=True
request, addon, channel_id, 'devhub.submit.version.details', wizard=True
)


Expand Down Expand Up @@ -1849,37 +1849,36 @@ def _submit_source(request, addon, version, submit_page, next_view):
def submit_addon_source(request, addon_id, addon, channel):
channel = amo.CHANNEL_CHOICES_LOOKUP[channel]
version = addon.find_latest_version(channel=channel)
return _submit_source(request, addon, version, 'addon', 'devhub.submit.details')
return _submit_source(request, addon, version, 'addon', 'devhub.submit.finish')


@dev_required(submitting=True)
def submit_version_source(request, addon_id, addon, version_id):
version = get_object_or_404(addon.versions.all(), id=version_id)
return _submit_source(
request, addon, version, 'version', 'devhub.submit.version.details'
request, addon, version, 'version', 'devhub.submit.version.finish'
)


@require_submissions_enabled
def _submit_details(request, addon, version):
def _submit_details(request, addon, version, next_view):
static_theme = addon.type == amo.ADDON_STATICTHEME
if version:
skip_details_step = version.channel == amo.CHANNEL_UNLISTED or (
static_theme and addon.has_complete_metadata()
)
if skip_details_step:
# Nothing to do here.
return redirect('devhub.submit.version.finish', addon.slug, version.pk)
return redirect(next_view, addon.slug, version.pk)
latest_version = version
else:
# Figure out the latest version early in order to pass the same
# instance to each form that needs it (otherwise they might overwrite
# each other).
latest_version = addon.find_latest_version(channel=amo.CHANNEL_LISTED)
if not latest_version:
# No listed version ? Then nothing to do in the listed submission
# flow.
return redirect('devhub.submit.finish', addon.slug)
# No listed version? It must be an unlisted version then.
return redirect(next_view, addon.slug, 'unlisted')

forms_list = []
context = {
Expand Down Expand Up @@ -1938,9 +1937,9 @@ def _submit_details(request, addon, version):
reviewer_form.save()

if not version:
return redirect('devhub.submit.finish', addon.slug)
return redirect(next_view, addon.slug, 'listed')
else:
return redirect('devhub.submit.version.finish', addon.slug, version.id)
return redirect(next_view, addon.slug, version.id)
template = 'devhub/addons/submit/%s' % (
'describe.html' if show_all_fields else 'describe_minimal.html'
)
Expand All @@ -1949,13 +1948,13 @@ def _submit_details(request, addon, version):

@dev_required(submitting=True)
def submit_addon_details(request, addon_id, addon):
return _submit_details(request, addon, None)
return _submit_details(request, addon, None, 'devhub.submit.source')


@dev_required(submitting=True)
def submit_version_details(request, addon_id, addon, version_id):
version = get_object_or_404(addon.versions.all(), id=version_id)
return _submit_details(request, addon, version)
return _submit_details(request, addon, version, 'devhub.submit.version.source')


@require_submissions_enabled
Expand Down
Loading