Repository: pretalx/pretalx

Issue:
Contact reviewers
## Problem you are facing

I wanted to inform the reviewers that they should start reviewing the talks, with the deadline and so on. It doesn't seem to be possible.

## Possible Solution

Add a tick box in `https://<domain>/orga/event/<event>/mails/compose` to mail the reviewers.

## Context

Just making sure the reviewers know they should start the reviews.



Discussion:

Resolving patch:
diff --git a/src/pretalx/orga/forms/mails.py b/src/pretalx/orga/forms/mails.py
--- a/src/pretalx/orga/forms/mails.py
+++ b/src/pretalx/orga/forms/mails.py
@@ -53,7 +53,8 @@ class WriteMailForm(forms.ModelForm):
         ('accepted', _('All accepted speakers (who have not confirmed their talk yet)')),
         ('confirmed', _('All confirmed speakers')),
         ('rejected', _('All rejected speakers')),
-        ('selected_submissions', _('All speakers of the selected submissions below'))
+        ('selected_submissions', _('All speakers of the selected submissions below')),
+        ('reviewers', _('All reviewers in your team')),
     ), widget=forms.CheckboxSelectMultiple)
     submissions = forms.MultipleChoiceField(required=False)
     reply_to = forms.EmailField(required=False)
diff --git a/src/pretalx/orga/views/mails.py b/src/pretalx/orga/views/mails.py
--- a/src/pretalx/orga/views/mails.py
+++ b/src/pretalx/orga/views/mails.py
@@ -11,6 +11,7 @@
 from pretalx.mail.context import get_context_explanation
 from pretalx.mail.models import MailTemplate, QueuedMail
 from pretalx.orga.forms.mails import MailDetailForm, MailTemplateForm, WriteMailForm
+from pretalx.person.models import User
 
 
 class OutboxList(PermissionRequired, Sortable, Filterable, ListView):
@@ -223,12 +224,22 @@ def get_success_url(self):
     def form_valid(self, form):
         email_set = set()
 
-        for state in form.cleaned_data.get('recipients'):
-            if state == 'selected_submissions':
-                submission_filter = {'code__in': form.cleaned_data.get('submissions')}
+        for recipient in form.cleaned_data.get('recipients'):
+            if recipient == 'reviewers':
+                mails = User.objects.filter(
+                    teams__in=self.request.event.teams.filter(is_reviewer=True)
+                ).distinct().values_list('email', flat=True)
             else:
-                submission_filter = {'state': state}
-            email_set.update(self.request.event.submissions.filter(**submission_filter).values_list('speakers__email', flat=True))
+                if recipient == 'selected_submissions':
+                    submission_filter = {'code__in': form.cleaned_data.get('submissions')}
+                else:
+                    submission_filter = {'state': recipient}  # e.g. "submitted"
+
+                mails = self.request.event.submissions \
+                    .filter(**submission_filter) \
+                    .values_list('speakers__email', flat=True)
+
+            email_set.update(mails)
 
         for email in email_set:
             QueuedMail.objects.create(


Test patch:
diff --git a/src/tests/functional/orga/test_mail.py b/src/tests/functional/orga/test_mail.py
--- a/src/tests/functional/orga/test_mail.py
+++ b/src/tests/functional/orga/test_mail.py
@@ -249,6 +249,22 @@ def test_orga_can_compose_single_mail_selected_submissions(orga_client, event, s
     assert mails[0].to == other_submission.speakers.first().email
 
 
+@pytest.mark.django_db
+def test_orga_can_compose_single_mail_reviewers(orga_client, event, orga_user, review_user):
+    assert QueuedMail.objects.filter(sent__isnull=True).count() == 0
+    response = orga_client.post(
+        event.orga_urls.compose_mails, follow=True,
+        data={
+            'recipients': 'reviewers',
+            'bcc': '', 'cc': '', 'reply_to': '', 'subject': 'foo', 'text': 'bar',
+        },
+    )
+    assert response.status_code == 200
+    mails = list(QueuedMail.objects.filter(sent__isnull=True))
+    assert len(mails) == 1
+    assert mails[0].to == review_user.email
+
+
 @pytest.mark.django_db
 def test_orga_can_compose_single_mail_from_template(orga_client, event, submission):
     response = orga_client.get(