From 2c5915942f05a637b3e75e2a469d07d42bbfd4f7 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Wed, 20 Jul 2016 21:32:27 +0200 Subject: [PATCH] Email authors upon revision request --- submissions/utils.py | 30 ++++++++++++++++++++++++++++++ submissions/views.py | 3 +++ 2 files changed, 33 insertions(+) diff --git a/submissions/utils.py b/submissions/utils.py index 203793adb..750860717 100644 --- a/submissions/utils.py +++ b/submissions/utils.py @@ -486,3 +486,33 @@ class SubmissionUtils(object): bcc_emails, reply_to=['submissions@scipost.org']) emailmessage.send(fail_silently=False) + + + @classmethod + def send_author_revision_requested_email(cls): + """ Requires loading 'submission' and 'recommendation' attributes. """ + email_text = ('Dear ' + title_dict[cls.submission.submitted_by.title] + ' ' + + cls.submission.submitted_by.user.last_name + + ', \n\nThe Editor-in-charge of your recent Submission to SciPost,\n\n' + + cls.submission.title + ' by ' + cls.submission.author_list + ',' + '\n\nhas formulated and Editorial Recommendation, asking for a ') + if cls.recommendation.recommendation == -1: + email_text += 'minor' + elif cls.recommendation.recommendation == -2: + email_text += 'major' + email_text += (' revision.' + '\n\nYou can view it at the Submission Page ' + 'https://scipost.org/submission/' + + cls.submission.arxiv_identifier_w_vn_nr + '.' + 'Note that the recommendation is viewable only by ' + 'the registered authors of the submission.' + '\n\nWe thank you very much for your contribution.' + '\n\nSincerely,' + + '\n\nThe SciPost Team.') + emailmessage = EmailMessage( + 'SciPost: revision requested', email_text, + 'SciPost Editorial Admin <submissions@scipost.org>', + [cls.submission.submitted_by.user.email], + ['submissions@scipost.org'], + reply_to=['submissions@scipost.org']) + emailmessage.send(fail_silently=False) diff --git a/submissions/views.py b/submissions/views.py index d523ca0fb..f0bdebc89 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -896,6 +896,9 @@ def eic_recommendation(request, arxiv_identifier_w_vn_nr): elif (recommendation.recommendation == -1 or recommendation.recommendation == -2): submission.status = 'revision_requested' + SubmissionUtils.load({'submission': submission, + 'recommendation': recommendation}) + SubmissionUtils.send_author_revision_requested_email() submission.open_for_reporting = False submission.save() -- GitLab