add an option to delay publishing to submission flow (bug 810009)
This commit is contained in:
Родитель
4cf0ca0157
Коммит
046f2a2e04
|
@ -423,8 +423,7 @@ def recaptcha(context, form):
|
|||
@register.filter
|
||||
def is_choice_field(value):
|
||||
try:
|
||||
return (hasattr(value.field, 'choices') and
|
||||
isinstance(value.field.widget, CheckboxInput))
|
||||
return isinstance(value.field.widget, CheckboxInput)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -324,10 +324,10 @@ def mkt_breadcrumbs(context, product=None, items=None, crumb_size=40,
|
|||
|
||||
@register.function
|
||||
def form_field(field, label=None, tag='div', req=None, opt=False, hint=False,
|
||||
some_html=False, cc_startswith=None, cc_for=None,
|
||||
tooltip=False, some_html=False, cc_startswith=None, cc_for=None,
|
||||
cc_maxlength=None, grid=False, cls=None, **attrs):
|
||||
c = dict(field=field, label=label or field.label, tag=tag, req=req,
|
||||
opt=opt, hint=hint, some_html=some_html,
|
||||
opt=opt, hint=hint, tooltip=tooltip, some_html=some_html,
|
||||
cc_startswith=cc_startswith, cc_for=cc_for,
|
||||
cc_maxlength=cc_maxlength, grid=grid, cls=cls, attrs=attrs)
|
||||
t = env.get_template('site/helpers/simple_field.html').render(**c)
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
{% from 'includes/forms.html' import required, optional, tip %}
|
||||
{% from 'developers/includes/macros.html' import some_html_tip %}
|
||||
|
||||
{% macro simple_label(field, label, opt, req, tooltip, hint) %}
|
||||
{% macro simple_label(field, label, opt, req, hint) %}
|
||||
<label class="{{ 'choice' if choice }}" for="{{ field.auto_id }}">
|
||||
{{ label }}
|
||||
</label>
|
||||
|
||||
{% if field.field.required and req != False %}{{ required() -}}{% endif %}
|
||||
{% if opt %}{{ optional() -}}{% endif %}
|
||||
|
||||
{% endmacro %}
|
||||
|
||||
{% if tag %}
|
||||
<{{ tag }} class="brform simple-field c {{ cls }}{{ ' error' if field.errors }}">
|
||||
{% endif %}
|
||||
{% set choice = field|is_choice_field %}
|
||||
{% if not tooltip %}{% set tooltip = field.help_text %}{% endif %}
|
||||
|
||||
{% if grid %}
|
||||
<div class="form-label">
|
||||
|
@ -23,7 +21,8 @@
|
|||
{% if choice %}{{ field.as_widget() }}{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{{ simple_label(field, label, opt, req, tooltip, hint) }}
|
||||
{{ simple_label(field, label, opt, req, hint) }}
|
||||
{% if tooltip %}{{ tip(None, field.help_text) }}{% endif %}
|
||||
|
||||
{% if grid %}
|
||||
</div>
|
||||
|
@ -38,7 +37,7 @@
|
|||
{{ field.as_widget(attrs=attrs) }}
|
||||
{% endif %}
|
||||
|
||||
{% if hint and tooltip %}
|
||||
{% if hint %}
|
||||
<span class="hint">{{ field.help_text }}</span>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -316,6 +316,14 @@ class AppDetailsBasicForm(AddonFormBasic):
|
|||
(0, _lazy(u'No')),
|
||||
),
|
||||
widget=forms.RadioSelect)
|
||||
publish = forms.BooleanField(required=False, initial=1,
|
||||
label=_lazy(u"Publish my app in the Firefox Marketplace as soon as "
|
||||
"it's reviewed."),
|
||||
help_text=_lazy(u"If selected your app will be published immediately "
|
||||
"following its approval by reviewers. If you don't "
|
||||
"select this option you will be notified via email "
|
||||
"about your app's approval and you will need to log "
|
||||
"in and manually publish it."))
|
||||
|
||||
class Meta:
|
||||
model = Addon
|
||||
|
|
|
@ -190,6 +190,9 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_field(form_basic.publish, tooltip=True) }}
|
||||
|
||||
<button class="prominent continue c" type="submit">
|
||||
{{ _('Continue') }}
|
||||
</button>
|
||||
|
|
|
@ -15,9 +15,21 @@
|
|||
<section id="submit-done" class="primary{{ ' payments' if payments }}">
|
||||
<h2>{{ _('Success! What happens now?') }}</h2>
|
||||
<div class="island devhub-form c">
|
||||
<p>{{ _("We've got your app saved and ready to go! Your app is currently
|
||||
awaiting review, and will show up on listing pages and in search once it is reviewed.
|
||||
Until then, feel free to tweak your app's details and settings.") }}</p>
|
||||
{% if addon.make_public == amo.PUBLIC_WAIT %}
|
||||
<p>
|
||||
{% trans url=addon.get_dev_url('versions') %}
|
||||
We've got your app saved and ready to go! Your app is currently
|
||||
awaiting review, and once it is reviewed you will need to be manually
|
||||
enable your app from the <a href="{{ url }}">Manage Status page</a>
|
||||
for it to show up on listing pages and in search. Until then, feel
|
||||
free to tweak your app's details and settings.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
{% else %}
|
||||
<p>{{ _("We've got your app saved and ready to go! Your app is currently
|
||||
awaiting review, and will show up on listing pages and in search once it is reviewed.
|
||||
Until then, feel free to tweak your app's details and settings.") }}</p>
|
||||
{% endif %}
|
||||
<footer class="listing-footer button-wrapper">
|
||||
{% if payments %}
|
||||
<a href="{{ addon.get_dev_url('payments') }}" class="button prominent">
|
||||
|
|
|
@ -563,6 +563,7 @@ class TestDetails(TestSubmit):
|
|||
'support_email': 'krupa+to+the+rescue@goodreads.com',
|
||||
'categories': [self.cat1.id],
|
||||
'flash': '1',
|
||||
'publish': '1'
|
||||
}
|
||||
# Add the required screenshot.
|
||||
data.update(self.preview_formset({
|
||||
|
@ -580,20 +581,24 @@ class TestDetails(TestSubmit):
|
|||
addon = self.get_webapp()
|
||||
|
||||
# Build a dictionary of expected results.
|
||||
expected = {
|
||||
expected_data = {
|
||||
'name': 'Test name',
|
||||
'app_slug': 'testname',
|
||||
'summary': 'Hello!',
|
||||
'description': 'desc',
|
||||
'privacy_policy': 'XXX <script>alert("xss")</script>',
|
||||
'uses_flash': 'True',
|
||||
'uses_flash': True,
|
||||
'make_public': amo.PUBLIC_IMMEDIATELY
|
||||
}
|
||||
expected.update(expected)
|
||||
if expected:
|
||||
expected_data.update(expected)
|
||||
|
||||
for field, expected in expected.iteritems():
|
||||
for field, expected in expected_data.iteritems():
|
||||
got = unicode(getattr(addon, field))
|
||||
expected = unicode(expected)
|
||||
eq_(got, expected,
|
||||
'Expected %r for %r. Got %r.' % (expected, field, got))
|
||||
|
||||
self.assertSetEqual(addon.device_types, self.device_types)
|
||||
|
||||
def test_success(self):
|
||||
|
@ -623,6 +628,19 @@ class TestDetails(TestSubmit):
|
|||
self.webapp = self.get_webapp()
|
||||
self.assert3xx(r, self.get_url('done'))
|
||||
|
||||
def test_success_for_public_waiting(self):
|
||||
self._step()
|
||||
|
||||
data = self.get_dict()
|
||||
del data['publish']
|
||||
|
||||
r = self.client.post(self.url, data)
|
||||
self.assertNoFormErrors(r)
|
||||
|
||||
self.check_dict(data=data, expected={'make_public': amo.PUBLIC_WAIT})
|
||||
self.webapp = self.get_webapp()
|
||||
self.assert3xx(r, self.get_url('done'))
|
||||
|
||||
def test_no_video_types(self):
|
||||
self._step()
|
||||
res = self.client.get(self.url)
|
||||
|
|
|
@ -170,7 +170,13 @@ def details(request, addon_id, addon):
|
|||
tasks.generate_image_assets.delay(addon)
|
||||
|
||||
AppSubmissionChecklist.objects.get(addon=addon).update(details=True)
|
||||
addon.mark_done()
|
||||
|
||||
# The developer doesn't want the app published immediately upon review.
|
||||
addon.update(status=amo.STATUS_PENDING,
|
||||
make_public=amo.PUBLIC_IMMEDIATELY
|
||||
if form_basic.cleaned_data.get('publish')
|
||||
else amo.PUBLIC_WAIT)
|
||||
|
||||
return redirect('submit.app.done', addon.app_slug)
|
||||
|
||||
ctx = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче