diff --git a/comments/views.py b/comments/views.py index 859fe0f535c50bf4462b832260097741957f06c9..5d73af0afd4cb27d21178e30493158b9c6760610 100644 --- a/comments/views.py +++ b/comments/views.py @@ -100,7 +100,8 @@ def vet_submitted_comment(request, comment_id): content_object.add_event_for_author('A new Comment has been added.') if not comment.is_author_reply: mail_sender = DirectMailUtil( - 'authors/inform_authors_comment_received', submission=content_object) + 'authors/inform_authors_comment_received', + instance=content_object, comment=comment) mail_sender.send_mail() elif isinstance(content_object, Report): # Add events to related Submission and send mail to author of the Submission @@ -123,6 +124,19 @@ def vet_submitted_comment(request, comment_id): 'authors/inform_authors_contributor_commented_report', report=content_object) mail_sender.send_mail() + elif isinstance(content_object, Comment): + # This means that this Comment is part of a hierarchy of Comments. + # We thus go back to the core object + core_content_object = comment.core_content_object + if isinstance(core_content_object, Submission): + # Add events to Submission and send mail to author of the Submission + core_content_object.add_event_for_eic('A Comment has been accepted.') + core_content_object.add_event_for_author('A new Comment has been added.') + if not comment.is_author_reply: + mail_sender = DirectMailUtil( + 'authors/inform_authors_comment_received', + instance=core_content_object, comment=comment) + mail_sender.send_mail() # In all cases, email the comment author mail_sender = DirectMailUtil( @@ -154,17 +168,17 @@ def vet_submitted_comment(request, comment_id): if isinstance(comment.content_object, Submission): submission = comment.content_object if submission.editor_in_charge == request.user.contributor: - # Redirect a EIC back to the Editorial Page! + # Redirect a EIC back to the Editorial Page return redirect(reverse('submissions:editorial_page', args=(submission.preprint.identifier_w_vn_nr,))) elif isinstance(comment.content_object, Report): submission = comment.content_object.submission if submission.editor_in_charge == request.user.contributor: - # Redirect a EIC back to the Editorial Page! + # Redirect a EIC back to the Editorial Page return redirect(reverse('submissions:editorial_page', args=(submission.preprint.identifier_w_vn_nr,))) elif request.user.has_perm('scipost.can_vet_comments'): - # Redirect vetters back to check for other unvetted comments! + # Redirect vetters back to check for other unvetted comments return redirect(reverse('comments:vet_submitted_comments_list')) return redirect(comment.get_absolute_url()) diff --git a/templates/email/authors/inform_authors_comment_received.html b/templates/email/authors/inform_authors_comment_received.html index 451de1eaaa2bbc0b84ca682f0fe48cfa5ada56dc..4c833668c949bc4d928bc9c8e9359ad1273236af 100644 --- a/templates/email/authors/inform_authors_comment_received.html +++ b/templates/email/authors/inform_authors_comment_received.html @@ -9,7 +9,7 @@ (see https://scipost.org{{ submission.get_absolute_url }} - first submitted {{ submission.original_submission_date|date:"d M Y" }}). </p> <p> - You can view it at the <a href="https://scipost.org/submission/{{ submission.preprint.identifier_w_vn_nr }}">Submission\'s Page</a>. + You can view it <a href="https://scipost.org{{ comment.get_absolute_url }}">here</a>, embedded within your <a href="https://scipost.org/submission/{{ submission.get_absolute_url }}">Submission\'s Page</a>. </p> <p>Sincerely,</p> <p>The SciPost Team</p>