fix: Improve status page for canceled submissions (#6221)

* fix: Show quieter alert for metadata error in canceled submission

* fix: Suppress metadata errors and show warning for canceled submissions

* style: Fix indentation in HTML

* fix: Give better notice of a processing error
This commit is contained in:
Jennifer Richards 2023-08-26 17:58:40 -03:00 committed by GitHub
parent c65cd20f0c
commit 6adead355d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 4 deletions

View file

@ -317,7 +317,10 @@ def submission_status(request, submission_id, access_token=None):
if access_token and not key_matched:
raise Http404
errors = validate_submission(submission)
if submission.state.slug == "cancel":
errors = {}
else:
errors = validate_submission(submission)
passes_checks = all([ c.passed!=False for c in submission.checks.all() ])
is_secretariat = has_role(request.user, "Secretariat")
@ -353,7 +356,21 @@ def submission_status(request, submission_id, access_token=None):
message = None
if submission.state_id == "cancel":
message = ('error', 'This submission has been cancelled, modification is no longer possible.')
# would be nice to have a less heuristic mechansim for reporting async processing failure
async_processing_error = submission.submissionevent_set.filter(
desc__startswith="Submission rejected: A system error occurred"
).exists()
if async_processing_error:
message = (
"error",
"This submission has been cancelled due to a system error during processing. "
"Modification is no longer possible.",
)
else:
message = (
"error",
"This submission has been cancelled, modification is no longer possible.",
)
elif submission.state_id == "auth":
message = ('success', 'The submission is pending email authentication. An email has been sent to: %s' % ", ".join(confirmation_list))
elif submission.state_id == "grp-appr":

View file

@ -152,9 +152,13 @@
{% endwith %}
Please contact the secretariat for assistance if it has been more than an hour.
</div>
{% else %}
{% else %}
<h2 class="mt-5">Meta-data from the submission</h2>
{% if errors %}
{% if submission.state.slug == "cancel" %}
<div class="alert alert-warning my-3">
<b>Note:</b> The meta-data shown for a cancelled draft may be incorrect or incomplete.
</div>
{% elif errors %}
<div class="alert alert-danger my-3">
<p>
<b>Meta-Data errors found!</b>