Skip to content

Commit 0bc71c7

Browse files
committed
Fix problem with concurrent posts as reported in ietf-tools#813 by preventing
accidentally submitting a post twice (with Javascript) and modifying the move-old-files-to-archive code to not move the files away if they belong to the same submission as the one we're accepting (this mitigates a concurrent post to at least not end up with a non-existing draft). - Legacy-Id: 4112
1 parent 03980c3 commit 0bc71c7

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

ietf/submit/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ def perform_postREDESIGN(request, submission):
154154
e.save()
155155

156156
# clean up old files
157-
from ietf.idrfc.expire import move_draft_files_to_archive
158-
move_draft_files_to_archive(draft, prev_rev)
157+
if prev_rev != draft.rev:
158+
from ietf.idrfc.expire import move_draft_files_to_archive
159+
move_draft_files_to_archive(draft, prev_rev)
159160

160161
# automatic state changes
161162
state_change_msg = ""

ietf/templates/submit/draft_status.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,14 @@ <h2>Cancel submission</h2>
245245
<br>Please send problem reports to <a href="mailto:ietf-action@ietf.org">ietf-action@ietf.org</a>.
246246
</p>
247247
{% endblock %}
248+
249+
{% block scripts %}
250+
jQuery(function () {
251+
jQuery("form").submit(function() {
252+
if (this.submittedAlready)
253+
return false;
254+
else
255+
this.submittedAlready = true;
256+
});
257+
});
258+
{% endblock %}

ietf/templates/submit/last_confirmation_step.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,14 @@ <h2>Confirm auto-post</h2>
1313
<input type="submit" value="Auto-Post" />
1414
</form>
1515
{% endblock %}
16+
17+
{% block scripts %}
18+
jQuery(function () {
19+
jQuery("form").submit(function() {
20+
if (this.submittedAlready)
21+
return false;
22+
else
23+
this.submittedAlready = true;
24+
});
25+
});
26+
{% endblock %}

0 commit comments

Comments
 (0)