Skip to content

Commit 83c03a1

Browse files
authored
Merge branch 'master' into jbrazeal/dropdowns
2 parents 79a48c8 + ebbf020 commit 83c03a1

File tree

3 files changed

+24
-30
lines changed

3 files changed

+24
-30
lines changed

pgcommitfest/commitfest/templates/patch_commands.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<li role="presentation"><a href="close/reject/" onclick="return verify_reject()">Rejected</a></li>
2222
<li role="presentation"><a href="close/withdrawn/" onclick="return verify_withdrawn()">Withdrawn</a></li>
2323
<li role="presentation"><a href="close/feedback/" onclick="return verify_returned()">Returned with feedback</a></li>
24-
<li role="presentation"><a href="close/next/" onclick="return verify_next()">Move to next CF</a></li>
24+
<li role="presentation"><a href="close/next/?cfid={{cf.id}}" onclick="return verify_next()">Move to next CF</a></li>
2525
<li role="presentation"><a href="close/committed/" onclick="return flagCommitted({%if patch.committer%}'{{patch.committer}}'{%elif is_committer%}'{{user.username}}'{%else%}null{%endif%})">Committed</a></li>
2626
</ul>
2727
</div>
@@ -37,4 +37,4 @@
3737
</div>
3838
{%endif%}
3939

40-
</div>
40+
</div>

pgcommitfest/commitfest/views.py

+15-28
Original file line numberDiff line numberDiff line change
@@ -472,15 +472,6 @@ def comment(request, patchid, what):
472472
poc = get_object_or_404(PatchOnCommitFest, patch=patch, commitfest=cf)
473473
is_review = (what == 'review')
474474

475-
if poc.is_closed:
476-
# We allow modification of patches in closed CFs *only* if it's the
477-
# last CF that the patch is part of. If it's part of another CF, that
478-
# is later than this one, tell the user to go there instead.
479-
lastcf = PatchOnCommitFest.objects.filter(patch=patch).order_by('-commitfest__startdate')[0]
480-
if poc != lastcf:
481-
messages.add_message(request, messages.INFO, "The status of this patch cannot be changed in this commitfest. You must modify it in the one where it's open!")
482-
return HttpResponseRedirect('..')
483-
484475
if request.method == 'POST':
485476
try:
486477
form = CommentForm(patch, poc, is_review, data=request.POST)
@@ -568,15 +559,6 @@ def status(request, patchid, status):
568559
cf = patch.current_commitfest()
569560
poc = get_object_or_404(PatchOnCommitFest.objects.select_related(), commitfest__id=cf.id, patch__id=patchid)
570561

571-
if poc.is_closed:
572-
# We allow modification of patches in closed CFs *only* if it's the
573-
# last CF that the patch is part of. If it's part of another CF, that
574-
# is later than this one, tell the user to go there instead.
575-
lastcf = PatchOnCommitFest.objects.filter(patch__id=patchid).order_by('-commitfest__startdate')[0]
576-
if poc != lastcf:
577-
messages.add_message(request, messages.INFO, "The status of this patch cannot be changed in this commitfest. You must modify it in the one where it's open!")
578-
return HttpResponseRedirect('/%s/%s/' % (poc.commitfest.id, poc.patch.id))
579-
580562
if status == 'review':
581563
newstatus = PatchOnCommitFest.STATUS_REVIEW
582564
elif status == 'author':
@@ -595,24 +577,29 @@ def status(request, patchid, status):
595577

596578
PatchHistory(patch=poc.patch, by=request.user, what='New status: %s' % poc.statusstring).save_and_notify()
597579

598-
return HttpResponseRedirect('/%s/%s/' % (poc.commitfest.id, poc.patch.id))
580+
return HttpResponseRedirect('/patch/%s/' % (poc.patch.id))
599581

600582

601583
@login_required
602584
@transaction.atomic
603585
def close(request, patchid, status):
604586
patch = get_object_or_404(Patch.objects.select_related(), pk=patchid)
605587
cf = patch.current_commitfest()
606-
poc = get_object_or_404(PatchOnCommitFest.objects.select_related(), commitfest__id=cf.id, patch__id=patchid)
607588

608-
if poc.is_closed:
609-
# We allow modification of patches in closed CFs *only* if it's the
610-
# last CF that the patch is part of. If it's part of another CF, that
611-
# is later than this one, tell the user to go there instead.
612-
lastcf = PatchOnCommitFest.objects.filter(patch__id=patchid).order_by('-commitfest__startdate')[0]
613-
if poc != lastcf:
614-
messages.add_message(request, messages.INFO, "The status of this patch cannot be changed in this commitfest. You must modify it in the one where it's open!")
615-
return HttpResponseRedirect('/%s/%s/' % (poc.commitfest.id, poc.patch.id))
589+
try:
590+
request_cfid = int(request.GET.get('cfid', ''))
591+
except ValueError:
592+
# int() failed, ignore
593+
request_cfid = None
594+
595+
if request_cfid is not None and request_cfid != cf.id:
596+
# The cfid parameter is only added to the /next/ link. That's the only
597+
# close operation where two people pressing the button at the same time
598+
# can have unintended effects.
599+
messages.error(request, "The patch was moved to a new commitfest by someone else. Please double check if you still want to retry this operation.")
600+
return HttpResponseRedirect('/%s/%s/' % (cf.id, patch.id))
601+
602+
poc = get_object_or_404(PatchOnCommitFest.objects.select_related(), commitfest__id=cf.id, patch__id=patchid)
616603

617604
poc.leavedate = datetime.now()
618605

pgcommitfest/urls.py

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@
3838
re_path(r'^thread_notify/$', views.thread_notify),
3939
re_path(r'^cfbot_notify/$', views.cfbot_notify),
4040

41+
# Legacy email POST route. This can be safely removed in a few days from
42+
# the first time this is deployed. It's only puprose is not breaking
43+
# submissions from a previous page lood, during the deploy of the new
44+
# /patch/(\d+) routes. It would be a shame if someone lost their well
45+
# written email because of this.
46+
re_path(r'^\d+/(\d+)/send_email/$', views.send_patch_email),
47+
4148
# Auth system integration
4249
re_path(r'^(?:account/)?login/?$', pgcommitfest.auth.login),
4350
re_path(r'^(?:account/)?logout/?$', pgcommitfest.auth.logout),

0 commit comments

Comments
 (0)