diff --git a/pgcommitfest/commitfest/forms.py b/pgcommitfest/commitfest/forms.py index a01b437e..444905b1 100644 --- a/pgcommitfest/commitfest/forms.py +++ b/pgcommitfest/commitfest/forms.py @@ -5,7 +5,7 @@ from django.http import Http404 from .ajax import _archivesAPI -from .models import MailThread, Patch, PatchOnCommitFest, Tag, TargetVersion +from .models import Patch, PatchOnCommitFest, Tag, TargetVersion from .widgets import ThreadPickWidget @@ -214,91 +214,6 @@ def clean_threadmsgid(self): return self.cleaned_data["threadmsgid"] -def _fetch_thread_choices(patch): - for mt in patch.mailthread_set.order_by("-latestmessage"): - ti = sorted( - _archivesAPI("/message-id.json/%s" % mt.messageid), - key=lambda x: x["date"], - reverse=True, - ) - yield [ - mt.subject, - [ - ( - "%s,%s" % (mt.messageid, t["msgid"]), - "From %s at %s" % (t["from"], t["date"]), - ) - for t in ti - ], - ] - - -review_state_choices = ( - (0, "Tested"), - (1, "Passed"), -) - - -def reviewfield(label): - return forms.MultipleChoiceField( - choices=review_state_choices, - label=label, - widget=forms.CheckboxSelectMultiple, - required=False, - ) - - -class CommentForm(forms.Form): - responseto = forms.ChoiceField(choices=[], required=True, label="In response to") - - # Specific checkbox fields for reviews - review_installcheck = reviewfield("make installcheck-world") - review_implements = reviewfield("Implements feature") - review_spec = reviewfield("Spec compliant") - 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, 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"] - del self.fields["review_spec"] - del self.fields["review_doc"] - - def clean_responseto(self): - try: - (threadid, respid) = self.cleaned_data["responseto"].split(",") - self.thread = MailThread.objects.get(messageid=threadid) - self.respid = respid - except MailThread.DoesNotExist: - raise ValidationError("Selected thread appears to no longer exist") - except Exception: - raise ValidationError("Invalid message selected") - return self.cleaned_data["responseto"] - - def clean(self): - if self.is_review: - for fn, f in self.fields.items(): - if fn.startswith("review_") and fn in self.cleaned_data: - if ( - "1" in self.cleaned_data[fn] - and "0" not in self.cleaned_data[fn] - ): - self.errors[fn] = ( - ("Cannot pass a test without performing it!"), - ) - return self.cleaned_data - - class BulkEmailForm(forms.Form): reviewers = forms.CharField(required=False, widget=HiddenInput()) authors = forms.CharField(required=False, widget=HiddenInput()) diff --git a/pgcommitfest/commitfest/templates/base_form.html b/pgcommitfest/commitfest/templates/base_form.html index d4bb7805..01552912 100644 --- a/pgcommitfest/commitfest/templates/base_form.html +++ b/pgcommitfest/commitfest/templates/base_form.html @@ -51,14 +51,7 @@
{{e}}
{%endfor%} {%endif%} - {%if field.name|slice:":7" == 'review_' %} - {%for choice in field %} -
- - -
- {%endfor%} - {%elif not field.name in form.selectize_fields%}{{field|field_class:"form-control"}}{%else%}{{field}}{%endif%} + {%if not field.name in form.selectize_fields%}{{field|field_class:"form-control"}}{%else%}{{field}}{%endif%} {%if field.help_text%}
{{field.help_text|safe}}{%endif%} {%endif%} diff --git a/pgcommitfest/commitfest/templates/help.html b/pgcommitfest/commitfest/templates/help.html index 609f0214..1b7d556f 100644 --- a/pgcommitfest/commitfest/templates/help.html +++ b/pgcommitfest/commitfest/templates/help.html @@ -24,6 +24,9 @@

Patches

A "patch" is a bit of an overloaded term in the PostgreSQL community. Email threads on the mailing list often contain "patch files" as attachments, such a file is often referred to as a "patch". A single email can even contain multiple related "patch files", which are called a "patchset". However, in the context of a Commitfest app a "patch" usually means a "patch entry" in the Commitfest app. Such a "patch entry" is a reference to a mailinglist thread on which change to PostgreSQL has been proposed, by someone sending an email that contain one or more "patch files". The Commitfest app will automatically detect new versions of the patch files and update the "patch entry" accordingly.

+

+ To comment on or review a patch, reply to its thread on the mailinglist. If the thread is not in your inbox, open its latest message in the archives (linked on the patch page), log in, and use "Resend email" to get a copy that you can reply to. +

There are three "Active" categories of patch status: