Abuse reports: moderator form for resolving/dismissing + notification #173

Merged
Oleg-Komarov merged 7 commits from resolve-report-form into main 2024-06-07 17:04:54 +02:00
2 changed files with 2 additions and 7 deletions
Showing only changes of commit c8c7d1e389 - Show all commits

View File

@ -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

View File

@ -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 %}