summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest
diff options
context:
space:
mode:
Diffstat (limited to 'pgcommitfest/commitfest')
-rw-r--r--pgcommitfest/commitfest/forms.py4
-rw-r--r--pgcommitfest/commitfest/models.py1
-rw-r--r--pgcommitfest/commitfest/views.py21
3 files changed, 21 insertions, 5 deletions
diff --git a/pgcommitfest/commitfest/forms.py b/pgcommitfest/commitfest/forms.py
index 8c67d89..a083588 100644
--- a/pgcommitfest/commitfest/forms.py
+++ b/pgcommitfest/commitfest/forms.py
@@ -82,12 +82,14 @@ class CommentForm(forms.Form):
review_doc = reviewfield('Documentation')
message = forms.CharField(required=True, widget=forms.Textarea)
+ newstatus = forms.ChoiceField(choices=PatchOnCommitFest.OPEN_STATUS_CHOICES, label='New status')
- def __init__(self, patch, is_review, *args, **kwargs):
+ def __init__(self, patch, poc, is_review, *args, **kwargs):
super(CommentForm, self).__init__(*args, **kwargs)
self.is_review = is_review
self.fields['responseto'].choices = _fetch_thread_choices(patch)
+ self.fields['newstatus'].initial = poc.status
if not is_review:
del self.fields['review_installcheck']
del self.fields['review_implements']
diff --git a/pgcommitfest/commitfest/models.py b/pgcommitfest/commitfest/models.py
index f8ea862..76c582d 100644
--- a/pgcommitfest/commitfest/models.py
+++ b/pgcommitfest/commitfest/models.py
@@ -145,6 +145,7 @@ class PatchOnCommitFest(models.Model):
(STATUS_REJECTED, 'Rejected'),
)
OPEN_STATUSES=(STATUS_REVIEW, STATUS_AUTHOR, STATUS_COMMITTER)
+ OPEN_STATUS_CHOICES=[x for x in _STATUS_CHOICES if x[0] in OPEN_STATUSES]
patch = models.ForeignKey(Patch, blank=False, null=False)
commitfest = models.ForeignKey(CommitFest, blank=False, null=False)
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py
index f502f38..ff8ff0d 100644
--- a/pgcommitfest/commitfest/views.py
+++ b/pgcommitfest/commitfest/views.py
@@ -222,11 +222,16 @@ def _review_status_string(reviewstatus):
def comment(request, cfid, patchid, what):
cf = get_object_or_404(CommitFest, pk=cfid)
patch = get_object_or_404(Patch, pk=patchid)
+ poc = get_object_or_404(PatchOnCommitFest, patch=patch, commitfest=cf)
is_review = (what=='review')
+ if poc.is_closed:
+ 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!")
+ return HttpResponseRedirect('..')
+
if request.method == 'POST':
try:
- form = CommentForm(patch, is_review, data=request.POST)
+ form = CommentForm(patch, poc, is_review, data=request.POST)
except Exception, e:
messages.add_message(request, messages.ERROR, "Failed to build list of response options from the archives: %s" % e)
return HttpResponseRedirect('/%s/%s/' % (cf.id, patch.id))
@@ -237,9 +242,17 @@ def comment(request, cfid, patchid, what):
"\n".join(["%-25s %s" % (f.label + ':', _review_status_string(form.cleaned_data[fn])) for (fn, f) in form.fields.items() if fn.startswith('review_')]),
form.cleaned_data['message']
)
- msg = MIMEText(txt, _charset='utf-8')
else:
- msg = MIMEText(form.cleaned_data['message'], _charset='utf-8')
+ txt = form.cleaned_data['message']
+
+ if int(form.cleaned_data['newstatus']) != poc.status:
+ poc.status = int(form.cleaned_data['newstatus'])
+ poc.save()
+ PatchHistory(patch=poc.patch, by=request.user, what='New status: %s' % poc.statusstring).save()
+ txt += "\n\nThe new status of this patch is: %s\n" % poc.statusstring
+
+ msg = MIMEText(txt, _charset='utf-8')
+
if form.thread.subject.startswith('Re:'):
msg['Subject'] = form.thread.subject
else:
@@ -264,7 +277,7 @@ def comment(request, cfid, patchid, what):
return HttpResponseRedirect('/%s/%s/' % (cf.id, patch.id))
else:
try:
- form = CommentForm(patch, is_review)
+ form = CommentForm(patch, poc, is_review)
except Exception, e:
messages.add_message(request, messages.ERROR, "Failed to build list of response options from the archives: %s" % e)
return HttpResponseRedirect('/%s/%s/' % (cf.id, patch.id))