Fixed 'post first-click' bug.
Added domain into email with authorization key. Extend the type of submission that secretariat can cancel or autopost. Fixes #614 - Legacy-Id: 2882
This commit is contained in:
parent
28da455254
commit
d08c515e78
|
@ -318,7 +318,7 @@ class AutoPostForm(forms.Form):
|
|||
from_email = settings.IDST_FROM_EMAIL
|
||||
to_email = self.cleaned_data['email']
|
||||
send_mail(request, from_email, to_email, subject, 'submit/confirm_autopost.txt',
|
||||
{'draft': self.draft })
|
||||
{'draft': self.draft, 'domain': Site.objects.get_current().domain })
|
||||
|
||||
def save_submitter_info(self):
|
||||
return TempIdAuthors.objects.create(
|
||||
|
|
|
@ -55,7 +55,7 @@ class PlainParser(FileParser):
|
|||
filename = re.sub('\.txt$', '', filename)
|
||||
extra_chars = re.sub('[0-9a-z\-]', '', filename)
|
||||
if extra_chars:
|
||||
self.parsed_info.add_error('Filename contains non alpha-numeric character: %s' % ', '.join(set(extra_chars)))
|
||||
self.parsed_info.add_error(u'Filename contains non alpha-numeric character: %s' % (', '.join(set(extra_chars))).decode('ascii','replace'))
|
||||
match_revision = revisionre.match(filename)
|
||||
if match_revision:
|
||||
self.parsed_info.metadraft.revision = match_revision.group(1)
|
||||
|
|
|
@ -58,12 +58,19 @@ def _can_approve(user, detail):
|
|||
|
||||
|
||||
def _can_force_post(user, detail):
|
||||
if detail.status_id != MANUAL_POST_REQUESTED:
|
||||
if detail.status_id not in [MANUAL_POST_REQUESTED,
|
||||
WAITING_AUTHENTICATION, INITIAL_VERSION_APPROVAL_REQUESTED]:
|
||||
return None
|
||||
if is_secretariat(user):
|
||||
return True
|
||||
return False
|
||||
|
||||
def _can_cancel(user, detail):
|
||||
if detail.status_id == UPLOADED:
|
||||
return True
|
||||
if is_secretariat(user) and detail.status_id != CANCELED:
|
||||
return True
|
||||
return False
|
||||
|
||||
def draft_status(request, submission_id, message=None):
|
||||
detail = get_object_or_404(IdSubmissionDetail, submission_id=submission_id)
|
||||
|
@ -73,6 +80,7 @@ def draft_status(request, submission_id, message=None):
|
|||
allow_edit = True
|
||||
can_force_post = _can_force_post(request.user, detail)
|
||||
can_approve = _can_approve(request.user, detail)
|
||||
can_cancel = _can_cancel(request.user, detail)
|
||||
if detail.status_id != UPLOADED:
|
||||
if detail.status_id == CANCELED:
|
||||
message = ('error', 'This submission has been canceled, modification is no longer possible')
|
||||
|
@ -106,6 +114,15 @@ def draft_status(request, submission_id, message=None):
|
|||
return HttpResponseRedirect(reverse(draft_status, None, kwargs={'submission_id': detail.submission_id}))
|
||||
else:
|
||||
auto_post_form.save(request)
|
||||
detail = get_object_or_404(IdSubmissionDetail, submission_id=submission_id)
|
||||
validation = DraftValidation(detail)
|
||||
is_valid = validation.is_valid()
|
||||
status = detail.status
|
||||
can_force_post = _can_force_post(request.user, detail)
|
||||
can_approve = _can_approve(request.user, detail)
|
||||
can_cancel = _can_cancel(request.user, detail)
|
||||
allow_edit = False
|
||||
message = ('success', 'Your submission is pending of email authentication. An email has been sent you with instructions')
|
||||
else:
|
||||
return HttpResponseRedirect(reverse(draft_edit, None, kwargs={'submission_id': detail.submission_id}))
|
||||
else:
|
||||
|
@ -121,6 +138,7 @@ def draft_status(request, submission_id, message=None):
|
|||
'allow_edit': allow_edit,
|
||||
'can_force_post': can_force_post,
|
||||
'can_approve': can_approve,
|
||||
'can_cancel': can_cancel,
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Follow this link to confirm you Auto-Post of I-D {{ draft.filename }}-{{ draft.revision }}
|
||||
|
||||
I-D Submission Tool URL: /submit/status/{{ draft.submission_id }}/confirm/{{ draft.auth_key }}/
|
||||
I-D Submission Tool URL: http://{{ domain }}/submit/status/{{ draft.submission_id }}/confirm/{{ draft.auth_key }}/
|
||||
|
|
|
@ -171,11 +171,6 @@ returned to the submitter.
|
|||
</form>
|
||||
{% endif %}
|
||||
|
||||
<h2>Cancel submission</h2>
|
||||
<p>
|
||||
<input type="button" onclick="confirmCancelation();" value="Cancel Submission" /><br>
|
||||
This submission will be canceled, and its uploaded document(s) permanently deleted.
|
||||
</p>
|
||||
|
||||
{% else %}
|
||||
{% if validation.submitter %}
|
||||
|
@ -188,6 +183,14 @@ returned to the submitter.
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if can_cancel %}
|
||||
<h2>Cancel submission</h2>
|
||||
<p>
|
||||
<input type="button" onclick="confirmCancelation();" value="Cancel Submission" /><br>
|
||||
This submission will be canceled, and its uploaded document(s) permanently deleted.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if can_approve %}
|
||||
<p>
|
||||
<form method="post" action="/submit/status/{{ detail.submission_id }}/approve/">
|
||||
|
|
Loading…
Reference in a new issue