From 437a6221416d6267d3d0205b0848e49994dba0de Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sat, 7 Oct 2017 13:34:14 +0000 Subject: [PATCH] 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 --- ietf/name/fixtures/names.json | 52 +++++++++++++++++++---------------- ietf/submit/views.py | 5 ++++ 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/ietf/name/fixtures/names.json b/ietf/name/fixtures/names.json index fac0c11a3..23d222586 100644 --- a/ietf/name/fixtures/names.json +++ b/ietf/name/fixtures/names.json @@ -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" }, diff --git a/ietf/submit/views.py b/ietf/submit/views.py index 4a99a341b..eddfcd195 100644 --- a/ietf/submit/views.py +++ b/ietf/submit/views.py @@ -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()