Abuse reports: moderator form for resolving/dismissing + notification #173
@ -51,6 +51,7 @@ class ResolveReportForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.request = kwargs.pop('request')
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['moderator_note'].required = True
|
||||
|
||||
def clean(self):
|
||||
super().clean()
|
||||
@ -61,12 +62,6 @@ class ResolveReportForm(forms.ModelForm):
|
||||
self.instance.processed_by_moderator = self.request.user
|
||||
return self.cleaned_data
|
||||
|
||||
def clean_moderator_note(self, *args, **kwargs):
|
||||
moderator_note = self.cleaned_data.get('moderator_note')
|
||||
if not moderator_note:
|
||||
raise forms.ValidationError('this field is required')
|
||||
return moderator_note
|
||||
|
||||
def is_valid(self, *args, **kwargs) -> bool:
|
||||
if 'dismiss' not in self.data and 'resolve' not in self.data:
|
||||
return False
|
||||
|
@ -149,7 +149,7 @@
|
||||
{% with form=form|add_form_classes %}
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
{% include "common/components/field.html" with field=form.moderator_note placeholder="Add a note..." required=True %}
|
||||
{% include "common/components/field.html" with field=form.moderator_note placeholder="Add a note..." %}
|
||||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
|
Loading…
Reference in New Issue
Block a user