From 5876f352c85eb1c413088296559d1ed8abeb5de1 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Mon, 17 Dec 2018 09:41:04 +0100 Subject: [PATCH] Tested and ready to roll. --- comments/views.py | 12 ++++++++++++ templates/email/eic/inform_eic_comment_received.html | 2 +- templates/email/eic/inform_eic_comment_received.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/comments/views.py b/comments/views.py index 0ebf80723..25ce524ef 100644 --- a/comments/views.py +++ b/comments/views.py @@ -46,6 +46,18 @@ def new_comment(request, **kwargs): new_comment.save() new_comment.grant_permissions() + # Mails + mail_sender = DirectMailUtil( + mail_code='commenters/inform_commenter_comment_received', + instance=new_comment) + mail_sender.send() + + if isinstance(new_comment.core_content_object, Submission): + mail_sender = DirectMailUtil( + mail_code='eic/inform_eic_comment_received', + instance=new_comment) + mail_sender.send() + messages.success(request, strings.acknowledge_submit_comment) return redirect(_object.get_absolute_url()) context = {'form': form} diff --git a/templates/email/eic/inform_eic_comment_received.html b/templates/email/eic/inform_eic_comment_received.html index 33ea17ae1..b4e2c7804 100644 --- a/templates/email/eic/inform_eic_comment_received.html +++ b/templates/email/eic/inform_eic_comment_received.html @@ -9,7 +9,7 @@ by {{ comment.core_content_object.author_list }}. </p> <p> - Please vet this Comment on <a href="https://scipost.org{% url 'scipost:editorial_page' comment.core_content_object.preprint.identifier_w_vn_nr %}">the editorial page</a>. + Please vet this Comment on <a href="https://scipost.org{% url 'submissions:editorial_page' comment.core_content_object.preprint.identifier_w_vn_nr %}">the editorial page</a>. </p> <p> Many thanks in advance for your collaboration,<br> diff --git a/templates/email/eic/inform_eic_comment_received.json b/templates/email/eic/inform_eic_comment_received.json index 0ca12c5ca..90f695dc3 100644 --- a/templates/email/eic/inform_eic_comment_received.json +++ b/templates/email/eic/inform_eic_comment_received.json @@ -1,6 +1,6 @@ { "subject": "SciPost: Comment delivered", - "to_address": "comment.core_content_object.editor_in_charge.user.email", + "to_address": "core_content_object.editor_in_charge.user.email", "bcc_to": "edadmin@scipost.org", "from_address_name": "SciPost Refereeing", "from_address": "refereeing@scipost.org", -- GitLab