Set a temporary state 'confirmed' when handling submission confirmations in order to avoid running the confirmation code multiple times on multiple form submits.
- Legacy-Id: 14191
This commit is contained in:
parent
1c3a613c2a
commit
437a622141
|
@ -7756,16 +7756,6 @@
|
|||
"model": "name.doctypename",
|
||||
"pk": "statchg"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"desc": "",
|
||||
"name": "Document Source Repository",
|
||||
"order": 0,
|
||||
"used": true
|
||||
},
|
||||
"model": "name.docurltagname",
|
||||
"pk": "repository"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"desc": "",
|
||||
|
@ -7776,6 +7766,16 @@
|
|||
"model": "name.docurltagname",
|
||||
"pk": "issues"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"desc": "",
|
||||
"name": "Document source repository",
|
||||
"order": 0,
|
||||
"used": true
|
||||
},
|
||||
"model": "name.docurltagname",
|
||||
"pk": "repository"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"desc": "",
|
||||
|
@ -7816,21 +7816,12 @@
|
|||
"model": "name.docurltagname",
|
||||
"pk": "yang-module-metadata"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"desc": "",
|
||||
"name": "Yang module tree view",
|
||||
"order": 0,
|
||||
"used": true
|
||||
},
|
||||
"model": "name.docurltagname",
|
||||
"pk": "yang-module-tree"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"desc": "",
|
||||
"name": "Awaiting Approval from Previous Version Authors",
|
||||
"next_states": [
|
||||
"confirmed",
|
||||
"cancel",
|
||||
"posted"
|
||||
],
|
||||
|
@ -7845,6 +7836,7 @@
|
|||
"desc": "",
|
||||
"name": "Awaiting Submitter Authentication",
|
||||
"next_states": [
|
||||
"confirmed",
|
||||
"cancel",
|
||||
"posted"
|
||||
],
|
||||
|
@ -7865,6 +7857,20 @@
|
|||
"model": "name.draftsubmissionstatename",
|
||||
"pk": "cancel"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"desc": "",
|
||||
"name": "Confirmed",
|
||||
"next_states": [
|
||||
"cancel",
|
||||
"posted"
|
||||
],
|
||||
"order": 0,
|
||||
"used": true
|
||||
},
|
||||
"model": "name.draftsubmissionstatename",
|
||||
"pk": "confirmed"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"desc": "",
|
||||
|
@ -9982,7 +9988,7 @@
|
|||
"fields": {
|
||||
"command": "xym",
|
||||
"switch": "--version",
|
||||
"time": "2017-09-26T22:17:08.858",
|
||||
"time": "2017-09-29T00:07:40.668",
|
||||
"used": true,
|
||||
"version": "xym 0.4"
|
||||
},
|
||||
|
@ -9993,7 +9999,7 @@
|
|||
"fields": {
|
||||
"command": "pyang",
|
||||
"switch": "--version",
|
||||
"time": "2017-09-26T22:17:11.006",
|
||||
"time": "2017-09-29T00:07:41.703",
|
||||
"used": true,
|
||||
"version": "pyang 1.7.3"
|
||||
},
|
||||
|
@ -10004,7 +10010,7 @@
|
|||
"fields": {
|
||||
"command": "yanglint",
|
||||
"switch": "--version",
|
||||
"time": "2017-09-26T22:17:11.079",
|
||||
"time": "2017-09-29T00:07:41.812",
|
||||
"used": true,
|
||||
"version": "yanglint 0.13.49"
|
||||
},
|
||||
|
|
|
@ -444,6 +444,11 @@ def confirm_submission(request, submission_id, auth_token):
|
|||
if not key_matched: key_matched = auth_token == submission.auth_key # backwards-compat
|
||||
|
||||
if request.method == 'POST' and submission.state_id in ("auth", "aut-appr") and key_matched:
|
||||
# Set a temporary state 'confirmed' to avoid entering this code
|
||||
# multiple times to confirm.
|
||||
submission.state = DraftSubmissionStateName.objects.get(slug="confirmed")
|
||||
submission.save()
|
||||
|
||||
action = request.POST.get('action')
|
||||
if action == 'confirm':
|
||||
submitter_parsed = submission.submitter_parsed()
|
||||
|
|
Loading…
Reference in a new issue