From d785f19a4edeb49469e1f1f3c89eea73502e58e3 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sun, 30 Apr 2017 05:35:19 +0200
Subject: [PATCH] Add email to referee upon Report submission

---
 submissions/utils.py                          |  7 +++++++
 submissions/views.py                          |  1 +
 templates/email/report_delivered_referee.html | 11 ++++++++++
 .../email/report_delivered_referee_html.html  | 21 +++++++++++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 templates/email/report_delivered_referee.html
 create mode 100644 templates/email/report_delivered_referee_html.html

diff --git a/submissions/utils.py b/submissions/utils.py
index cc2b18dc5..31f3d5522 100644
--- a/submissions/utils.py
+++ b/submissions/utils.py
@@ -995,6 +995,13 @@ class SubmissionUtils(BaseMailUtil):
                        [cls._context['report'].submission.editor_in_charge.user.email],
                        'Report delivered')
 
+    @classmethod
+    def email_referee_report_delivered(cls):
+        """ Requires loading 'report' attribute. """
+        cls._send_mail(cls, 'report_delivered_referee',
+                       [cls._context['report'].report.author.user.email],
+                       'Report delivered')
+
     @classmethod
     def acknowledge_report_email(cls):
         """ Requires loading 'report' attribute. """
diff --git a/submissions/views.py b/submissions/views.py
index 387ac0deb..ce94d8f6c 100644
--- a/submissions/views.py
+++ b/submissions/views.py
@@ -1126,6 +1126,7 @@ def submit_report(request, arxiv_identifier_w_vn_nr):
         author.save()
         SubmissionUtils.load({'report': newreport}, request)
         SubmissionUtils.email_EIC_report_delivered()
+        SubmissionUtils.email_referee_report_delivered()
 
         # Why is this session update?
         request.session['arxiv_identifier_w_vn_nr'] = arxiv_identifier_w_vn_nr
diff --git a/templates/email/report_delivered_referee.html b/templates/email/report_delivered_referee.html
new file mode 100644
index 000000000..a68b43dbd
--- /dev/null
+++ b/templates/email/report_delivered_referee.html
@@ -0,0 +1,11 @@
+Dear {{ invitation.referee.get_title_display }} {{ invitation.referee.user.last_name }},\n\n
+
+We hereby confirm reception of your Report on Submission\n\n
+
+{{ invitation.submission.title }}\n
+by {{ invitation.submission.author_list }}.\n\n
+
+We are immensely grateful for your time and effort. Your Report will soon be vetted by the Submission's Editor-in-charge, at which point you will receive an email update from us.\n\n
+
+Many thanks again,\n
+The SciPost Team.
diff --git a/templates/email/report_delivered_referee_html.html b/templates/email/report_delivered_referee_html.html
new file mode 100644
index 000000000..43a35a8de
--- /dev/null
+++ b/templates/email/report_delivered_referee_html.html
@@ -0,0 +1,21 @@
+<p>
+  Dear {{ invitation.referee.get_title_display }} {{ invitation.referee.user.last_name }},
+</p>
+
+<p>We hereby confirm reception of your Report on Submission</p>
+
+<p>
+  {{ invitation.submission.title }}
+  <br/>
+  by {{ invitation.submission.author_list }}.
+</p>
+
+<p>
+  We are immensely grateful for your time and effort. Your Report will soon be vetted by the Submission's Editor-in-charge, at which point you will receive an email update from us.
+</p>
+
+<p>
+  Many thanks again,
+  <br/>
+  The SciPost Team.
+</p>
-- 
GitLab