From f30f4c0c82cf80e81def16cdf08f6d4645db44c5 Mon Sep 17 00:00:00 2001 From: Jacob Champion Date: Tue, 19 Jul 2022 16:15:07 -0700 Subject: [PATCH] Allow users to move RwF patches directly Currently, to move a patch that's been Returned with Feedback to the next CF, you have to first set it to Needs Review, then Move to Next CF. Otherwise, the app will complain. Streamline this by allowing a RwF patch to be moved directly. It'll show up as Needs Review in the next available CF. --- pgcommitfest/commitfest/views.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index 6040c1b..2d9087a 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -544,12 +544,12 @@ def close(request, cfid, patchid, status): # Only some patch statuses can actually be moved. if poc.status in (PatchOnCommitFest.STATUS_COMMITTED, PatchOnCommitFest.STATUS_NEXT, - PatchOnCommitFest.STATUS_RETURNED, PatchOnCommitFest.STATUS_REJECTED): # Can't be moved! messages.error(request, "A patch in status {0} cannot be moved to next commitfest.".format(poc.statusstring)) return HttpResponseRedirect('/%s/%s/' % (poc.commitfest.id, poc.patch.id)) elif poc.status in (PatchOnCommitFest.STATUS_REVIEW, + PatchOnCommitFest.STATUS_RETURNED, PatchOnCommitFest.STATUS_AUTHOR, PatchOnCommitFest.STATUS_COMMITTER): # This one can be moved @@ -557,7 +557,11 @@ def close(request, cfid, patchid, status): else: messages.error(request, "Invalid existing patch status") - oldstatus = poc.status + newstatus = oldstatus = poc.status + if newstatus == PatchOnCommitFest.STATUS_RETURNED: + # If a patch is being resurrected from RwF, do the author a favor + # and mark it as Needs Review again. + newstatus = PatchOnCommitFest.STATUS_REVIEW poc.status = PatchOnCommitFest.STATUS_NEXT # Figure out the commitfest to actually put it on @@ -586,13 +590,18 @@ def close(request, cfid, patchid, status): elif len(newcf) != 1: messages.error(request, "Cannot move patch to the same commitfest, and multiple future commitfests exist!") return HttpResponseRedirect('/%s/%s/' % (poc.commitfest.id, poc.patch.id)) + # Create a mapping to the new commitfest that we are bouncing # this patch to. newpoc = PatchOnCommitFest(patch=poc.patch, commitfest=newcf[0], - status=oldstatus, + status=newstatus, enterdate=datetime.now()) newpoc.save() + + if newstatus != oldstatus: + PatchHistory(patch=newpoc.patch, by=request.user, what='New status: %s' % newpoc.statusstring).save_and_notify() + elif status == 'committed': committer = get_object_or_404(Committer, user__username=request.GET['c']) if committer != poc.patch.committer: -- 2.25.1