From 925fa92bf75fa683611e68cf1efb2c77d46c4b33 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Mon, 15 Apr 2024 13:58:49 +0200
Subject: [PATCH] add EIC first name when signing in behalf of EIC

---
 scipost_django/submissions/utils.py           | 15 +++++++++---
 .../invite_contributor_to_referee.html        | 16 +++++++------
 ...vite_contributor_to_referee_reminder1.html | 17 ++++++++------
 ...vite_contributor_to_referee_reminder2.html | 17 ++++++++------
 .../invite_unregistered_to_referee.html       | 23 +++++++++++--------
 ...ite_unregistered_to_referee_reminder1.html | 23 +++++++++++--------
 ...ite_unregistered_to_referee_reminder2.html | 23 +++++++++++--------
 .../reinvite_contributor_to_referee.html      | 16 ++++++-------
 8 files changed, 88 insertions(+), 62 deletions(-)

diff --git a/scipost_django/submissions/utils.py b/scipost_django/submissions/utils.py
index 40f32cc85..0a9811180 100644
--- a/scipost_django/submissions/utils.py
+++ b/scipost_django/submissions/utils.py
@@ -202,6 +202,8 @@ class SubmissionUtils(BaseMailUtil):
             "On behalf of the Editor-in-charge "
             + cls.invitation.submission.editor_in_charge.profile.get_title_display()
             + " "
+            + cls.invitation.submission.editor_in_charge.user.first_name
+            + " "
             + cls.invitation.submission.editor_in_charge.user.last_name
             + ", we would like to cordially remind you of our recent request to referee\n\n"
             + cls.invitation.submission.title
@@ -211,7 +213,7 @@ class SubmissionUtils(BaseMailUtil):
         )
         email_text_html = (
             "<p>Dear {{ title }} {{ last_name }},</p>"
-            "<p>On behalf of the Editor-in-charge {{ EIC_title }} {{ EIC_last_name }}, "
+            "<p>On behalf of the Editor-in-charge {{ EIC_title }} {{ EIC_first_name }} {{ EIC_last_name }}, "
             "we would like to cordially remind you of our recent request to referee</p>"
             "<p>{{ sub_title }}</p>"
             "\n<p>by {{ author_list }}.</p>"
@@ -287,6 +289,7 @@ class SubmissionUtils(BaseMailUtil):
             "last_name": cls.invitation.last_name,
             "EIC_title": cls.invitation.submission.editor_in_charge.profile.get_title_display(),
             "EIC_last_name": cls.invitation.submission.editor_in_charge.user.last_name,
+            "EIC_first_name": cls.invitation.submission.editor_in_charge.user.first_name,
             "sub_title": cls.invitation.submission.title,
             "author_list": cls.invitation.submission.author_list,
             "identifier_w_vn_nr": cls.invitation.submission.preprint.identifier_w_vn_nr,
@@ -328,6 +331,8 @@ class SubmissionUtils(BaseMailUtil):
             "On behalf of the Editor-in-charge "
             + cls.invitation.submission.editor_in_charge.profile.get_title_display()
             + " "
+            + cls.invitation.submission.editor_in_charge.user.first_name
+            + " "
             + cls.invitation.submission.editor_in_charge.user.last_name
             + ", we would like to cordially remind you of our recent request to referee\n\n"
             + cls.invitation.submission.title
@@ -337,7 +342,7 @@ class SubmissionUtils(BaseMailUtil):
         )
         email_text_html = (
             "<p>Dear {{ title }} {{ last_name }},</p>"
-            "<p>On behalf of the Editor-in-charge {{ EIC_title }} {{ EIC_last_name }}, "
+            "<p>On behalf of the Editor-in-charge {{ EIC_title }} {{ EIC_first_name }} {{ EIC_last_name }}, "
             "we would like to cordially remind you of our recent request to referee</p>"
             "<p>{{ sub_title }}</p>"
             "\n<p>by {{ author_list }}.</p>"
@@ -392,6 +397,7 @@ class SubmissionUtils(BaseMailUtil):
             "last_name": cls.invitation.last_name,
             "EIC_title": cls.invitation.submission.editor_in_charge.profile.get_title_display(),
             "EIC_last_name": cls.invitation.submission.editor_in_charge.user.last_name,
+            "EIC_first_name": cls.invitation.submission.editor_in_charge.user.first_name,
             "sub_title": cls.invitation.submission.title,
             "author_list": cls.invitation.submission.author_list,
             "identifier_w_vn_nr": cls.invitation.submission.preprint.identifier_w_vn_nr,
@@ -432,6 +438,8 @@ class SubmissionUtils(BaseMailUtil):
             "On behalf of the Editor-in-charge "
             + cls.invitation.submission.editor_in_charge.profile.get_title_display()
             + " "
+            + cls.invitation.submission.editor_in_charge.user.first_name
+            + " "
             + cls.invitation.submission.editor_in_charge.user.last_name
             + ", we would like to inform you that your report on\n\n"
             + cls.invitation.submission.title
@@ -444,7 +452,7 @@ class SubmissionUtils(BaseMailUtil):
         )
         email_text_html = (
             "<p>Dear {{ title }} {{ last_name }},</p>"
-            "<p>On behalf of the Editor-in-charge {{ EIC_title }} {{ EIC_last_name }}, "
+            "<p>On behalf of the Editor-in-charge {{ EIC_title }} {{ EIC_first_name }} {{ EIC_last_name }}, "
             "we would like to inform you that your report on</p>"
             "<p>{{ sub_title }}</p>"
             "\n<p>by {{ author_list }}</p>"
@@ -479,6 +487,7 @@ class SubmissionUtils(BaseMailUtil):
             "last_name": cls.invitation.last_name,
             "EIC_title": cls.invitation.submission.editor_in_charge.profile.get_title_display(),
             "EIC_last_name": cls.invitation.submission.editor_in_charge.user.last_name,
+            "EIC_first_name": cls.invitation.submission.editor_in_charge.user.first_name,
             "sub_title": cls.invitation.submission.title,
             "author_list": cls.invitation.submission.author_list,
             "invitation_key": cls.invitation.invitation_key,
diff --git a/scipost_django/templates/email/referees/invite_contributor_to_referee.html b/scipost_django/templates/email/referees/invite_contributor_to_referee.html
index bccacf1b4..1f3d78336 100644
--- a/scipost_django/templates/email/referees/invite_contributor_to_referee.html
+++ b/scipost_django/templates/email/referees/invite_contributor_to_referee.html
@@ -1,11 +1,12 @@
+<p>Dear {{ invitation.referee.profile.get_title_display }} {{ invitation.referee.user.last_name }},</p>
 <p>
-  Dear {{ invitation.referee.profile.get_title_display }} {{ invitation.referee.user.last_name }},
-</p>
-<p>
-  We have received a Submission to SciPost which, in view of your expertise and on behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.last_name }}, we would like to invite you to referee:
-  <br><br>
+  We have received a Submission to SciPost which, in view of your expertise and On behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.first_name }} {{ invitation.submission.editor_in_charge.user.last_name }}, we would like to invite you to referee:
+  <br />
+  <br />
   {{ invitation.submission.title }}
-  <br>by {{ invitation.submission.author_list }}<br>
+  <br />
+  by {{ invitation.submission.author_list }}
+  <br />
   (see https://{{ domain }}{{ invitation.submission.get_absolute_url }} - first submitted {{ invitation.submission.original_submission_date|date:"d M Y" }}).
 </p>
 <p>
@@ -19,7 +20,8 @@
 </p>
 <p>
   We would be extremely grateful for your contribution, and thank you in advance for your consideration.
-  <br><br>
+  <br />
+  <br />
   The SciPost Team.
 </p>
 {% include 'email/_footer.html' %}
diff --git a/scipost_django/templates/email/referees/invite_contributor_to_referee_reminder1.html b/scipost_django/templates/email/referees/invite_contributor_to_referee_reminder1.html
index dba8cb2ea..1e7020e47 100644
--- a/scipost_django/templates/email/referees/invite_contributor_to_referee_reminder1.html
+++ b/scipost_django/templates/email/referees/invite_contributor_to_referee_reminder1.html
@@ -1,11 +1,13 @@
 <h3>Re: refereeing invitation. First automatic reminder</h3>
+<p>Dear {{ invitation.referee.profile.get_title_display }} {{ invitation.referee.user.last_name }},</p>
 <p>
-  Dear {{ invitation.referee.profile.get_title_display }} {{ invitation.referee.user.last_name }},
-</p>
-<p>
-  Recently, on behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.last_name }}, we invited you to consider refereeing a Submission to {{ invitation.submission.submitted_to }}, namely<br><br>
-  {{ invitation.submission.title }}<br>
-  by {{ invitation.submission.author_list }}<br>
+  Recently, On behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.first_name }} {{ invitation.submission.editor_in_charge.user.last_name }}, we invited you to consider refereeing a Submission to {{ invitation.submission.submitted_to }}, namely
+  <br />
+  <br />
+  {{ invitation.submission.title }}
+  <br />
+  by {{ invitation.submission.author_list }}
+  <br />
   (see https://{{ domain }}{{ invitation.submission.get_absolute_url }} - first submitted {{ invitation.submission.original_submission_date|date:"d M Y" }}).
 </p>
 <p>
@@ -24,7 +26,8 @@
 </p>
 <p>
   We would be extremely grateful for your contribution, and thank you in advance for your consideration.
-  <br><br>
+  <br />
+  <br />
   The SciPost Team.
 </p>
 {% include 'email/_footer.html' %}
diff --git a/scipost_django/templates/email/referees/invite_contributor_to_referee_reminder2.html b/scipost_django/templates/email/referees/invite_contributor_to_referee_reminder2.html
index f198006d5..591e011b5 100644
--- a/scipost_django/templates/email/referees/invite_contributor_to_referee_reminder2.html
+++ b/scipost_django/templates/email/referees/invite_contributor_to_referee_reminder2.html
@@ -1,11 +1,13 @@
 <h3>Re: refereeing invitation. Second (and last) automatic reminder</h3>
+<p>Dear {{ invitation.referee.profile.get_title_display }} {{ invitation.referee.user.last_name }},</p>
 <p>
-  Dear {{ invitation.referee.profile.get_title_display }} {{ invitation.referee.user.last_name }},
-</p>
-<p>
-  Recently, on behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.last_name }}, we invited you to consider refereeing a Submission to {{ invitation.submission.submitted_to }}, namely<br><br>
-  {{ invitation.submission.title }}<br>
-  by {{ invitation.submission.author_list }}<br>
+  Recently, On behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.first_name }} {{ invitation.submission.editor_in_charge.user.last_name }}, we invited you to consider refereeing a Submission to {{ invitation.submission.submitted_to }}, namely
+  <br />
+  <br />
+  {{ invitation.submission.title }}
+  <br />
+  by {{ invitation.submission.author_list }}
+  <br />
   (see https://{{ domain }}{{ invitation.submission.get_absolute_url }} - first submitted {{ invitation.submission.original_submission_date|date:"d M Y" }}).
 </p>
 <p>
@@ -24,7 +26,8 @@
 </p>
 <p>
   We would be extremely grateful for your contribution, and thank you in advance for your consideration.
-  <br><br>
+  <br />
+  <br />
   The SciPost Team.
 </p>
 {% include 'email/_footer.html' %}
diff --git a/scipost_django/templates/email/referees/invite_unregistered_to_referee.html b/scipost_django/templates/email/referees/invite_unregistered_to_referee.html
index d4fdc975b..f977f8bc0 100644
--- a/scipost_django/templates/email/referees/invite_unregistered_to_referee.html
+++ b/scipost_django/templates/email/referees/invite_unregistered_to_referee.html
@@ -1,10 +1,12 @@
-<p>
-  Dear {{ invitation.get_title_display }} {{ invitation.last_name }},
-</p>
-<p>
-  On behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.last_name }}, we would like to invite you to referee a Submission to {{ invitation.submission.submitted_to }}, namely<br><br>
-  {{ invitation.submission.title }}<br>
-  by {{ invitation.submission.author_list }}<br>
+<p>Dear {{ invitation.get_title_display }} {{ invitation.last_name }},</p>
+<p>
+  On behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.first_name }} {{ invitation.submission.editor_in_charge.user.last_name }}, we would like to invite you to referee a Submission to {{ invitation.submission.submitted_to }}, namely
+  <br />
+  <br />
+  {{ invitation.submission.title }}
+  <br />
+  by {{ invitation.submission.author_list }}
+  <br />
   (see https://{{ domain }}{{ invitation.submission.get_absolute_url }} - first submitted {{ invitation.submission.original_submission_date|date:"d M Y" }}).
 </p>
 <p>
@@ -12,7 +14,7 @@
   we would appreciate a quick accept/decline response from you, ideally within the next 2 working days.
 </p>
 <p>
-  If you are <strong>not</strong> able to provide a Report, you can let us know by simply <a href="https://{{ domain }}/submissions/decline_ref_invitation/{{ invitation.invitation_key }}"> clicking here</a>.
+  If you are <strong>not</strong> able to provide a Report, you can let us know by simply <a href="https://{{ domain }}/submissions/decline_ref_invitation/{{ invitation.invitation_key }}">clicking here</a>.
 </p>
 <p>
   If you are able to provide a Report, you can confirm this after registering and logging in (you will automatically be prompted for a confirmation).
@@ -27,9 +29,10 @@
 </p>
 <p>
   We very much hope that we can count on your expertise,
-  <br>
+  <br />
   Many thanks in advance,
-  <br><br>
+  <br />
+  <br />
   The SciPost Team
 </p>
 
diff --git a/scipost_django/templates/email/referees/invite_unregistered_to_referee_reminder1.html b/scipost_django/templates/email/referees/invite_unregistered_to_referee_reminder1.html
index b3656b36d..80a151f12 100644
--- a/scipost_django/templates/email/referees/invite_unregistered_to_referee_reminder1.html
+++ b/scipost_django/templates/email/referees/invite_unregistered_to_referee_reminder1.html
@@ -1,11 +1,13 @@
 <h3>Re: refereeing invitation. First automatic reminder</h3>
-<p>
-  Dear {{ invitation.get_title_display }} {{ invitation.last_name }},
-</p>
-<p>
-  Recently, on behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.last_name }}, we invited you to consider refereeing a Submission to {{ invitation.submission.submitted_to }}, namely<br><br>
-  {{ invitation.submission.title }}<br>
-  by {{ invitation.submission.author_list }}<br>
+<p>Dear {{ invitation.get_title_display }} {{ invitation.last_name }},</p>
+<p>
+  Recently, On behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.first_name }} {{ invitation.submission.editor_in_charge.user.last_name }}, we invited you to consider refereeing a Submission to {{ invitation.submission.submitted_to }}, namely
+  <br />
+  <br />
+  {{ invitation.submission.title }}
+  <br />
+  by {{ invitation.submission.author_list }}
+  <br />
   (see https://{{ domain }}{{ invitation.submission.get_absolute_url }} - first submitted {{ invitation.submission.original_submission_date|date:"d M Y" }}).
 </p>
 <p>
@@ -14,7 +16,7 @@
   could you please let us know whether we can count on your expertise?
 </p>
 <p>
-  If you are <strong>not</strong> able to provide a Report, you can let us know by simply <a href="https://{{ domain }}/submissions/decline_ref_invitation/{{ invitation.invitation_key }}"> clicking here</a>.
+  If you are <strong>not</strong> able to provide a Report, you can let us know by simply <a href="https://{{ domain }}/submissions/decline_ref_invitation/{{ invitation.invitation_key }}">clicking here</a>.
 </p>
 <p>
   If you are able to provide a Report, you can confirm this after registering and logging in (you will automatically be prompted for a confirmation).
@@ -29,9 +31,10 @@
 </p>
 <p>
   We very much hope that we can count on your expertise,
-  <br>
+  <br />
   Many thanks in advance,
-  <br><br>
+  <br />
+  <br />
   The SciPost Team
 </p>
 
diff --git a/scipost_django/templates/email/referees/invite_unregistered_to_referee_reminder2.html b/scipost_django/templates/email/referees/invite_unregistered_to_referee_reminder2.html
index ac98bd3f2..0d062d411 100644
--- a/scipost_django/templates/email/referees/invite_unregistered_to_referee_reminder2.html
+++ b/scipost_django/templates/email/referees/invite_unregistered_to_referee_reminder2.html
@@ -1,11 +1,13 @@
 <h3>Re: refereeing invitation. Second (and last) automatic reminder</h3>
-<p>
-  Dear {{ invitation.get_title_display }} {{ invitation.last_name }},
-</p>
-<p>
-  Recently, on behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.last_name }}, we invited you to consider refereeing a Submission to {{ invitation.submission.submitted_to }}, namely<br><br>
-  {{ invitation.submission.title }}<br>
-  by {{ invitation.submission.author_list }}<br>
+<p>Dear {{ invitation.get_title_display }} {{ invitation.last_name }},</p>
+<p>
+  Recently, On behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.first_name }} {{ invitation.submission.editor_in_charge.user.last_name }}, we invited you to consider refereeing a Submission to {{ invitation.submission.submitted_to }}, namely
+  <br />
+  <br />
+  {{ invitation.submission.title }}
+  <br />
+  by {{ invitation.submission.author_list }}
+  <br />
   (see https://{{ domain }}{{ invitation.submission.get_absolute_url }} - first submitted {{ invitation.submission.original_submission_date|date:"d M Y" }}).
 </p>
 <p>
@@ -14,7 +16,7 @@
   could you please let us know whether we can count on your expertise?
 </p>
 <p>
-  If you are <strong>not</strong> able to provide a Report, you can let us know by simply <a href="https://{{ domain }}/submissions/decline_ref_invitation/{{ invitation.invitation_key }}"> clicking here</a>.
+  If you are <strong>not</strong> able to provide a Report, you can let us know by simply <a href="https://{{ domain }}/submissions/decline_ref_invitation/{{ invitation.invitation_key }}">clicking here</a>.
 </p>
 <p>
   If you are able to provide a Report, you can confirm this after registering and logging in (you will automatically be prompted for a confirmation).
@@ -29,9 +31,10 @@
 </p>
 <p>
   We very much hope that we can count on your expertise,
-  <br>
+  <br />
   Many thanks in advance,
-  <br><br>
+  <br />
+  <br />
   The SciPost Team
 </p>
 
diff --git a/scipost_django/templates/email/referees/reinvite_contributor_to_referee.html b/scipost_django/templates/email/referees/reinvite_contributor_to_referee.html
index 262cf7069..771cbff5d 100644
--- a/scipost_django/templates/email/referees/reinvite_contributor_to_referee.html
+++ b/scipost_django/templates/email/referees/reinvite_contributor_to_referee.html
@@ -2,19 +2,18 @@
 
 <p>
   The authors of submission
-  <br><br>
+  <br />
+  <br />
   {{ invitation.submission.title }}
-  <br>
+  <br />
   by {{ invitation.submission.author_list }}
-  <br>
+  <br />
   (<a href="https://{{ domain }}{{ invitation.submission.get_absolute_url }}">see on SciPost.org</a>)
 </p>
 <p>
-  have resubmitted their manuscript to SciPost. On behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.last_name }}, we would like to invite you to quickly review this new version.
-</p>
-<p>
-  Please accept or decline the invitation (login required) as soon as possible (ideally within the next 2 days).
+  have resubmitted their manuscript to SciPost. On behalf of the Editor-in-charge {{ invitation.submission.editor_in_charge.profile.get_title_display }} {{ invitation.submission.editor_in_charge.user.first_name }} {{ invitation.submission.editor_in_charge.user.last_name }}, we would like to invite you to quickly review this new version.
 </p>
+<p>Please accept or decline the invitation (login required) as soon as possible (ideally within the next 2 days).</p>
 <p>
   If you accept, your report can be submitted by simply clicking on the "Contribute a Report" link on the Submission's Page before the reporting deadline (currently set at {{ invitation.submission.reporting_deadline|date:'N j, Y' }}; your report will be automatically recognized as an invited report).
 </p>
@@ -23,7 +22,8 @@
 </p>
 <p>
   We would be extremely grateful for your contribution, and thank you in advance for your consideration.
-  <br><br>
+  <br />
+  <br />
   The SciPost Team.
 </p>
 
-- 
GitLab