From 0350477d45e6c4778dde1ab8cea48843c8ce2be3 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sun, 30 Apr 2017 12:17:23 +0200
Subject: [PATCH] Correct mistakes in emails to referee upon Report submission

---
 submissions/utils.py                               |  2 +-
 templates/email/report_delivered_eic.html          | 12 +++++++-----
 templates/email/report_delivered_eic_html.html     |  8 +++++---
 templates/email/report_delivered_referee.html      |  6 +++---
 templates/email/report_delivered_referee_html.html |  6 +++---
 5 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/submissions/utils.py b/submissions/utils.py
index 31f3d5522..d713236f3 100644
--- a/submissions/utils.py
+++ b/submissions/utils.py
@@ -999,7 +999,7 @@ class SubmissionUtils(BaseMailUtil):
     def email_referee_report_delivered(cls):
         """ Requires loading 'report' attribute. """
         cls._send_mail(cls, 'report_delivered_referee',
-                       [cls._context['report'].report.author.user.email],
+                       [cls._context['report'].author.user.email],
                        'Report delivered')
 
     @classmethod
diff --git a/templates/email/report_delivered_eic.html b/templates/email/report_delivered_eic.html
index 2bd15d68d..fe01130b3 100644
--- a/templates/email/report_delivered_eic.html
+++ b/templates/email/report_delivered_eic.html
@@ -1,11 +1,13 @@
-Dear {{report.submission.editor_in_charge.get_title_display}} {{report.submission.editor_in_charge.user.last_name}},\n\n
+Dear {{ report.submission.editor_in_charge.get_title_display }} {{ report.submission.editor_in_charge.user.last_name }},\n\n
 
-Referee {{report.author.get_title_display}} {{report.author.user.last_name}} has delivered a Report for Submission "{{report.submission.title}} by {{report.submission.author_list}}".
+Referee {{ report.author.get_title_display }} {{ report.author.user.last_name }} has delivered a Report for Submission\n\n
+{{ report.submission.title }}\n
+by {{ report.submission.author_list }}.
 \n\n
 
-Please vet this Report via your personal page under the Editorial Actions tab.\n
-https://scipost.org{% url 'scipost:personal_page' %}
-\n\n\n
+Please vet this Report via your personal page at
+https://scipost.org{% url 'scipost:personal_page' %}, under the Editorial Actions tab.\n
+\n\n
 
 Many thanks in advance for your collaboration,\n
 The SciPost Team.
diff --git a/templates/email/report_delivered_eic_html.html b/templates/email/report_delivered_eic_html.html
index f13181d93..11d7d9f82 100644
--- a/templates/email/report_delivered_eic_html.html
+++ b/templates/email/report_delivered_eic_html.html
@@ -1,10 +1,12 @@
-<p>Dear {{report.submission.editor_in_charge.get_title_display}} {{report.submission.editor_in_charge.user.last_name}},</p>
+<p>Dear {{ report.submission.editor_in_charge.get_title_display }} {{ report.submission.editor_in_charge.user.last_name }},</p>
 
 <p>
-    Referee {{report.author.get_title_display}} {{report.author.user.last_name}} has delivered a Report for Submission:
+    Referee {{ report.author.get_title_display }} {{ report.author.user.last_name }} has delivered a Report for Submission:
 </p>
 <p>
-    "{{report.submission.title}} by {{report.submission.author_list}}"
+  {{report.submission.title}}
+  <br/>
+  by {{ report.submission.author_list }}.
 </p>
 <p>
     Please vet this Report via your <a href="https://scipost.org{% url 'scipost:personal_page' %}">personal page</a> under the Editorial Actions tab.
diff --git a/templates/email/report_delivered_referee.html b/templates/email/report_delivered_referee.html
index a68b43dbd..ecff9be7a 100644
--- a/templates/email/report_delivered_referee.html
+++ b/templates/email/report_delivered_referee.html
@@ -1,9 +1,9 @@
-Dear {{ invitation.referee.get_title_display }} {{ invitation.referee.user.last_name }},\n\n
+Dear {{ report.author.get_title_display }} {{ report.author.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
+{{ report.submission.title }}\n
+by {{ report.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
 
diff --git a/templates/email/report_delivered_referee_html.html b/templates/email/report_delivered_referee_html.html
index 43a35a8de..9e50b5f4b 100644
--- a/templates/email/report_delivered_referee_html.html
+++ b/templates/email/report_delivered_referee_html.html
@@ -1,13 +1,13 @@
 <p>
-  Dear {{ invitation.referee.get_title_display }} {{ invitation.referee.user.last_name }},
+  Dear {{ report.author.get_title_display }} {{ report.author.user.last_name }},
 </p>
 
 <p>We hereby confirm reception of your Report on Submission</p>
 
 <p>
-  {{ invitation.submission.title }}
+  {{ report.submission.title }}
   <br/>
-  by {{ invitation.submission.author_list }}.
+  by {{ report.submission.author_list }}.
 </p>
 
 <p>
-- 
GitLab