diff --git a/comments/models.py b/comments/models.py index 689ec70074d8eeeef0ff73dd1bd1e9f622907396..08090b59a5e15f9cd6d4199087c446b152bec4b1 100644 --- a/comments/models.py +++ b/comments/models.py @@ -117,6 +117,7 @@ class Comment(TimeStampedModel): to_object = self.content_object while True: + # Loop because of possible nested relations if (isinstance(to_object, Submission) or isinstance(to_object, Commentary) or isinstance(to_object, ThesisLink)): return to_object diff --git a/comments/views.py b/comments/views.py index 1f62b7f16ddd1cbdb6d3b3a3850423cf45d14f20..38b61f266e7cfb51b29fa5c981d4316910f4f6e3 100644 --- a/comments/views.py +++ b/comments/views.py @@ -1,7 +1,7 @@ __copyright__ = "Copyright 2016-2018, Stichting SciPost (SciPost Foundation)" __license__ = "AGPL v3" - +import time from django.contrib.auth.decorators import permission_required, login_required from django.contrib import messages from django.core.urlresolvers import reverse @@ -20,7 +20,6 @@ from .utils import validate_file_extention from commentaries.models import Commentary from mails.utils import DirectMailUtil -from submissions.utils import SubmissionUtils from submissions.models import Submission, Report from theses.models import ThesisLink @@ -47,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} @@ -167,6 +178,7 @@ def vet_submitted_comment(request, comment_id): @permission_required('scipost.can_submit_comments', raise_exception=True) +@transaction.atomic def reply_to_comment(request, comment_id): comment = get_object_or_404(Comment, pk=comment_id) @@ -183,7 +195,6 @@ def reply_to_comment(request, comment_id): else: # No idea what this could be, but just to be sure is_author = related_object.author == request.user.contributor - form = CommentForm(request.POST or None, request.FILES or None) if form.is_valid(): newcomment = form.save(commit=False) @@ -193,6 +204,19 @@ def reply_to_comment(request, comment_id): newcomment.save() newcomment.grant_permissions() + mail_sender = DirectMailUtil( + mail_code='commenters/inform_commenter_comment_received', + instance=newcomment, + delayed_processing=True) + mail_sender.send() + + if isinstance(newcomment.core_content_object, Submission): + mail_sender = DirectMailUtil( + mail_code='eic/inform_eic_comment_received', + instance=newcomment, + delayed_processing=True) + mail_sender.send() + messages.success(request, '<h3>Thank you for contributing a Reply</h3>' 'It will soon be vetted by an Editor.') return redirect(newcomment.content_object.get_absolute_url()) @@ -217,6 +241,18 @@ def reply_to_report(request, report_id): newcomment.save() newcomment.grant_permissions() + mail_sender = DirectMailUtil( + mail_code='eic/inform_eic_comment_received', + instance=newcomment, + delayed_processing=True) + mail_sender.send() + + mail_sender = DirectMailUtil( + mail_code='commenters/inform_commenter_comment_received', + instance=newcomment, + delayed_processing=True) + mail_sender.send() + messages.success(request, '<h3>Thank you for contributing a Reply</h3>' 'It will soon be vetted by an Editor.') return redirect(newcomment.content_object.get_absolute_url()) diff --git a/mails/admin.py b/mails/admin.py index 6967486fda3158c00f55d1233d4b8b1d568be0a8..7fa9f68ca1ae63a3c6fe1de6fba0c9b1be615140 100644 --- a/mails/admin.py +++ b/mails/admin.py @@ -8,7 +8,8 @@ from .models import MailLog class MailLogAdmin(admin.ModelAdmin): - list_display = ['__str__', 'to_recipients', 'created', 'processed'] + list_display = ['__str__', 'to_recipients', 'created', 'status'] + list_filter = ['status'] readonly_fields = ('created', 'latest_activity') diff --git a/mails/backends/filebased.py b/mails/backends/filebased.py index 1c0e26d9f14c23b5e337bcaface786a3933f714d..71688950a3c5ad2eefc6748415643ce13c39c5b7 100644 --- a/mails/backends/filebased.py +++ b/mails/backends/filebased.py @@ -49,11 +49,23 @@ class ModelEmailBackend(FileBacked): except AttributeError: pass + content_object = None + mail_code = '' + if 'delayed_processing' in email_message.extra_headers and email_message.extra_headers: + status = 'not_rendered' + content_object = email_message.extra_headers.get('content_object', None) + mail_code = email_message.extra_headers.get('mail_code', '') + else: + status = 'rendered' + MailLog.objects.create( body=body, subject=subject, body_html=body_html, to_recipients=to_recipients, bcc_recipients=bcc_recipients, - from_email=from_email) + from_email=from_email, + status=status, + content_object=content_object, + mail_code=mail_code) return True diff --git a/mails/management/commands/send_mails.py b/mails/management/commands/send_mails.py index c684889d1b0d83caff363ed2422b52963fcb0b9a..a810d2fcd96d88ce9ee67246875f352c8acdb801 100644 --- a/mails/management/commands/send_mails.py +++ b/mails/management/commands/send_mails.py @@ -2,7 +2,7 @@ from django.core.management.base import BaseCommand from django.conf import settings from ...models import MailLog - +from ...utils import DirectMailUtil class Command(BaseCommand): """ @@ -13,6 +13,19 @@ class Command(BaseCommand): '--id', type=int, required=False, help='The id in the `MailLog` table for a specific mail, Leave blank to send all') + def _process_mail(self, mail): + """ + Render the templates for the mail if not done yet. + """ + mail_util = DirectMailUtil( + mail_code=mail.mail_code, + instance=mail.content_object) # This will process the mail, but: not send yet! + + MailLog.objects.filter(id=mail.id).update( + body=mail_util.mail_data['message'], + body_html=mail_util.mail_data['html_message'], + status='rendered') + def send_mails(self, mails): from django.core.mail import get_connection, EmailMultiAlternatives @@ -28,6 +41,10 @@ class Command(BaseCommand): connection = get_connection(backend=backend, fail_silently=False) count = 0 for db_mail in mails: + if db_mail.status == 'not_rendered': + self._process_mail(db_mail) + db_mail.refresh_from_db() + mail = EmailMultiAlternatives( db_mail.subject, db_mail.body, @@ -42,6 +59,7 @@ class Command(BaseCommand): if response: count += 1 db_mail.processed = True + db_mail.status = 'sent' db_mail.save() return count @@ -49,6 +67,6 @@ class Command(BaseCommand): if options.get('id'): mails = MailLog.objects.filter(id=options['id']) else: - mails = MailLog.objects.unprocessed() + mails = MailLog.objects.not_sent() nr_mails = self.send_mails(mails) self.stdout.write('Sent {} mails.'.format(nr_mails)) diff --git a/mails/managers.py b/mails/managers.py index 1be95a3768d1353c9452e5dec6b7df91d3e6aa5a..782b3ebdefe6f72d467558879ad6d3e59c89939a 100644 --- a/mails/managers.py +++ b/mails/managers.py @@ -2,5 +2,11 @@ from django.db import models class MailLogQuerySet(models.QuerySet): - def unprocessed(self): - return self.filter(processed=False) + def not_sent(self): + return self.filter(status__in=['not_rendered', 'rendered']) + + def unrendered(self): + return self.filter(status='not_rendered') + + def rendered(self): + return self.filter(status='rendered') diff --git a/mails/migrations/0004_auto_20181217_1050.py b/mails/migrations/0004_auto_20181217_1050.py new file mode 100644 index 0000000000000000000000000000000000000000..8c0c98cc78df395af5b042a57457b36714e551cf --- /dev/null +++ b/mails/migrations/0004_auto_20181217_1050.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-12-17 09:50 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('mails', '0003_auto_20180502_1807'), + ] + + operations = [ + migrations.AddField( + model_name='maillog', + name='content_type', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType'), + ), + migrations.AddField( + model_name='maillog', + name='mail_code', + field=models.CharField(blank=True, max_length=254), + ), + migrations.AddField( + model_name='maillog', + name='object_id', + field=models.PositiveIntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='maillog', + name='status', + field=models.CharField(choices=[('not_rendered', 'Not rendered'), ('rendered', 'Rendered'), ('sent', 'Sent')], default='rendered', max_length=16), + ), + ] diff --git a/mails/migrations/0005_auto_20181217_1051.py b/mails/migrations/0005_auto_20181217_1051.py new file mode 100644 index 0000000000000000000000000000000000000000..e1f8697828702b72183a411f43733e16bba0907b --- /dev/null +++ b/mails/migrations/0005_auto_20181217_1051.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-12-17 09:51 +from __future__ import unicode_literals + +from django.db import migrations + + +def set_statuses(apps, schema_editor): + MailLog = apps.get_model('mails', 'MailLog') + MailLog.objects.filter(processed=True).update(status='sent') + + +class Migration(migrations.Migration): + + dependencies = [ + ('mails', '0004_auto_20181217_1050'), + ] + + operations = [ + migrations.RunPython(set_statuses, reverse_code=migrations.RunPython.noop), + ] diff --git a/mails/mixins.py b/mails/mixins.py index 1dbb645792a5083b3a085362e3fdc456fde8d2e3..00a40447701e0dd7e3247f6eadf22092f9f64fef 100644 --- a/mails/mixins.py +++ b/mails/mixins.py @@ -2,6 +2,7 @@ __copyright__ = "Copyright 2016-2018, Stichting SciPost (SciPost Foundation)" __license__ = "AGPL v3" +import time import re import json import inspect @@ -25,6 +26,7 @@ class MailUtilsMixin: message = '' original_recipient = '' mail_sent = False + delayed_processing = False def __init__(self, *args, **kwargs): """Init an instance for a specific mail_code. @@ -68,10 +70,11 @@ class MailUtilsMixin: self.instance = self.get_object(**kwargs) # Digest the templates - mail_template = loader.get_template('email/%s.html' % self.mail_code) - if self.instance and self.mail_data.get('context_object'): - kwargs[self.mail_data['context_object']] = self.instance - self.mail_template = mail_template.render(kwargs) + if not self.delayed_processing: + mail_template = loader.get_template('email/%s.html' % self.mail_code) + if self.instance and self.mail_data.get('context_object'): + kwargs[self.mail_data['context_object']] = self.instance + self.mail_template = mail_template.render(kwargs) # Damn slow. # Gather Recipients data try: @@ -200,7 +203,12 @@ class MailUtilsMixin: '%s <%s>' % (self.mail_data['from_address_name'], self.mail_data['from_address']), self.mail_data['recipients'], bcc=self.mail_data['bcc_list'], - reply_to=[self.mail_data['from_address']]) + reply_to=[self.mail_data['from_address']], + headers={ + 'delayed_processing': self.delayed_processing, + 'content_object': self.get_object(), + 'mail_code': self.mail_code, + }) # Send html version if available if 'html_message' in self.mail_data: diff --git a/mails/models.py b/mails/models.py index e77a920cb305247cf47a914e1deb278d65bc24d6..88d210eeca6dfc20e78688c37f2ae5c3c1e972b9 100644 --- a/mails/models.py +++ b/mails/models.py @@ -3,10 +3,20 @@ __license__ = "AGPL v3" from django.db import models +from django.contrib.contenttypes.fields import GenericForeignKey +from django.contrib.contenttypes.models import ContentType from django.contrib.postgres.fields import ArrayField from .managers import MailLogQuerySet +MAIL_NOT_RENDERED, MAIL_RENDERED = 'not_rendered', 'rendered' +MAIL_SENT = 'sent' +MAIL_STATUSES = ( + (MAIL_NOT_RENDERED, 'Not rendered'), + (MAIL_RENDERED, 'Rendered'), + (MAIL_SENT, 'Sent'), +) + class MailLog(models.Model): """ @@ -15,6 +25,12 @@ class MailLog(models.Model): the chosen MailBackend. """ processed = models.BooleanField(default=False) + status = models.CharField(max_length=16, choices=MAIL_STATUSES, default=MAIL_RENDERED) + + mail_code = models.CharField(max_length=254, blank=True) + content_type = models.ForeignKey(ContentType, blank=True, null=True, on_delete=models.CASCADE) + object_id = models.PositiveIntegerField(blank=True, null=True) + content_object = GenericForeignKey('content_type', 'object_id') body = models.TextField() body_html = models.TextField(blank=True) diff --git a/mails/utils.py b/mails/utils.py index 8eb019df4dad59996a94c3a0efabccff6fbccafa..9ac090d6e5a46ebd472bfed436dfcfaa1d2fe450 100644 --- a/mails/utils.py +++ b/mails/utils.py @@ -14,5 +14,6 @@ class DirectMailUtil(MailUtilsMixin): def __init__(self, mail_code, *args, **kwargs): kwargs['mail_code'] = mail_code kwargs['instance'] = kwargs.pop('instance', None) + self.delayed_processing = kwargs.pop('delayed_processing', False) super().__init__(*args, **kwargs) self.validate() diff --git a/submissions/forms.py b/submissions/forms.py index 6272112e305d14a766459d1beead62e0b03031a6..fb79b272212a30273721b430d61ad0f36e48df26 100644 --- a/submissions/forms.py +++ b/submissions/forms.py @@ -1119,18 +1119,21 @@ class VetReportForm(forms.Form): def process_vetting(self, current_contributor): """Set the right report status and update submission fields if needed.""" report = self.cleaned_data['report'] - report.vetted_by = current_contributor if self.cleaned_data['action_option'] == REPORT_ACTION_ACCEPT: # Accept the report as is - report.status = STATUS_VETTED - report.submission.latest_activity = timezone.now() - report.submission.save() + Report.objects.filter(id=report.id).update( + status=STATUS_VETTED, + vetted_by=current_contributor, + ) + report.submission.touch() elif self.cleaned_data['action_option'] == REPORT_ACTION_REFUSE: # The report is rejected - report.status = self.cleaned_data['refusal_reason'] + Report.objects.filter(id=report.id).update( + status=self.cleaned_data['refusal_reason'], + ) else: raise exceptions.InvalidReportVettingValue(self.cleaned_data['action_option']) - report.save() + report.refresh_from_db() return report diff --git a/submissions/models.py b/submissions/models.py index eb215940c293c93fe85d36b3970c8ebc987e511a..8c71c49e5d1c293c04ab94ec568f0bfbc37e2d0a 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -36,6 +36,7 @@ from scipost.behaviors import TimeStampedModel from scipost.constants import TITLE_CHOICES from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS from scipost.fields import ChoiceArrayField +from scipost.models import Contributor from scipost.storage import SecureFileStorage from journals.constants import SCIPOST_JOURNALS_DOMAINS from journals.models import Publication @@ -343,6 +344,21 @@ class Submission(models.Model): return self.editorial_assignments.filter(status=STATUS_PREASSIGNED).exists() + def has_inadequate_pool_composition(self): + """ + Check whether the EIC actually in the pool of the Submission. + + (Could happen on resubmission or reassignment after wrong Journal selection) + """ + if not self.editor_in_charge: + # None assigned yet. + return False + + pool_contributors_ids = Contributor.objects.filter( + fellowships__pool=self).values_list('id', flat=True) + return self.editor_in_charge.id not in pool_contributors_ids + + class SubmissionEvent(SubmissionRelatedObjectMixin, TimeStampedModel): """Private message directly related to a Submission. diff --git a/submissions/templates/partials/submissions/pool/submission_li.html b/submissions/templates/partials/submissions/pool/submission_li.html index 470fe0eb8bcf2bf18b784242212a86af99fce99d..2fb06f06d456c0b9e1f5bf53292e491b175b8d6c 100644 --- a/submissions/templates/partials/submissions/pool/submission_li.html +++ b/submissions/templates/partials/submissions/pool/submission_li.html @@ -1,4 +1,7 @@ {% load submissions_pool %} +{% load user_groups %} + +{% is_edcol_admin request.user as is_editorial_admin %} <div class="icons"> {% include 'partials/submissions/pool/submission_tooltip.html' with submission=submission %} @@ -53,7 +56,14 @@ <span class="label label-sm label-secondary">{{ submission.get_status_display }}</span> </div> </div> - + {% if is_editorial_admin and submission.has_inadequate_pool_composition %} + <div class="border border-danger text-danger mt-1 py-1 px-2"> + <strong> + <i class="fa fa-exclamation-triangle"></i> + Notice to admin: The current editor is not assigned to the pool. Therefore, the editor will not be able to reach the editorial page. + </strong> + </div> + {% endif %} {% if submission.cycle.has_required_actions and submission.cycle.get_required_actions %} <div class="card-text bg-danger text-white mt-1 py-1 px-2"> This Submission contains required actions, <a href="{% url 'submissions:pool' submission.preprint.identifier_w_vn_nr %}" class="text-white" data-toggle="dynamic" data-target="#container_{{ submission.id }}">click to see details.</a> {% include 'partials/submissions/pool/required_actions_tooltip.html' with submission=submission classes='text-white' %} diff --git a/submissions/utils.py b/submissions/utils.py index 2343dc5af4559db2ecb2f31da3fef68a26c2201e..f7cff092decec37f7af314e0c28766b9f4709c99 100644 --- a/submissions/utils.py +++ b/submissions/utils.py @@ -837,20 +837,6 @@ class SubmissionUtils(BaseMailUtil): [cls._context['invitation'].referee.user.email], email_subject) - @classmethod - def email_EIC_report_delivered(cls): - """ Requires loading 'report' attribute. """ - cls._send_mail(cls, 'report_delivered_eic', - [cls._context['report'].submission.editor_in_charge.user.email], - 'Report delivered') - - @classmethod - def email_referee_report_delivered(cls): - """ Requires loading 'report' attribute. """ - cls._send_mail(cls, 'report_delivered_referee', - [cls._context['report'].author.user.email], - 'Report delivered') - @classmethod def acknowledge_report_email(cls): """ Requires loading 'report' attribute. """ diff --git a/submissions/views.py b/submissions/views.py index 3ae50a5702a8882bbcf74922559395f21f415c3a..9a2475b3ded2cd97d767a1ca069d8bce1e272894 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -1,6 +1,7 @@ __copyright__ = "Copyright 2016-2018, Stichting SciPost (SciPost Foundation)" __license__ = "AGPL v3" +import time import datetime import feedparser import strings @@ -48,6 +49,7 @@ from common.utils import workdays_between from invitations.constants import STATUS_SENT from invitations.models import RegistrationInvitation from journals.models import Journal +from mails.utils import DirectMailUtil from mails.views import MailEditingSubView from ontology.models import Topic from ontology.forms import SelectTopicForm @@ -681,6 +683,12 @@ def editorial_assignment(request, identifier_w_vn_nr, assignment_id=None): if form.is_normal_cycle(): # Inform authors about new status. SubmissionUtils.send_author_prescreening_passed_email() + else: + # Inform authors about new status. + mail_sender = DirectMailUtil( + mail_code='authors/inform_authors_eic_assigned_direct_eic', + assignment=submission) + mail_sender.send() submission.add_general_event('The Editor-in-charge has been assigned.') msg = 'Thank you for becoming Editor-in-charge of this submission.' @@ -1511,9 +1519,16 @@ def submit_report(request, identifier_w_vn_nr): 'identifier_w_vn_nr': identifier_w_vn_nr})) # Send mails if report is submitted - SubmissionUtils.load({'report': newreport}, request) - SubmissionUtils.email_EIC_report_delivered() - SubmissionUtils.email_referee_report_delivered() + mail_sender = DirectMailUtil( + mail_code='referees/inform_referee_report_received', + instance=newreport, + delayed_processing=True) + mail_sender.send() + mail_sender = DirectMailUtil( + mail_code='eic/inform_eic_report_received', + instance=newreport, + delayed_processing=True) + mail_sender.send() # Add SubmissionEvents for the EIC only, as it can also be rejected still submission.add_event_for_eic('%s has submitted a new Report.' @@ -1558,7 +1573,6 @@ def vet_submitted_report(request, report_id): submissions = Submission.objects.filter_for_eic(request.user) report = get_object_or_404(Report.objects.filter( submission__in=submissions).awaiting_vetting(), id=report_id) - form = VetReportForm(request.POST or None, initial={'report': report}) if form.is_valid(): report = form.process_vetting(request.user.contributor) @@ -1571,7 +1585,6 @@ def vet_submitted_report(request, report_id): # Add SubmissionEvent for the EIC report.submission.add_event_for_eic('The Report by %s is vetted.' % report.author.user.last_name) - if report.status == STATUS_VETTED: SubmissionUtils.send_author_report_received_email() diff --git a/templates/email/authors/inform_authors_eic_assigned_direct_rec.html b/templates/email/authors/inform_authors_eic_assigned_direct_rec.html new file mode 100644 index 0000000000000000000000000000000000000000..e2f489e94ae9dc7430be4b0c90f6f6134ebd57dc --- /dev/null +++ b/templates/email/authors/inform_authors_eic_assigned_direct_rec.html @@ -0,0 +1,19 @@ +<p> + Dear {{ submission.submitted_by.get_title_display }} {{ submission.submitted_by.user.last_name }}, +</p> +<p> + For your information, a Contributor Comment has been posted on a recent Report on your Submission + <br><br> + {{ submission.title }} + <br>by {{ submission.author_list }}<br> + (see https://scipost.org{{ submission.get_absolute_url }}. +</p> + +<p>has been assigned to an editor. The editor chose to directly formulate an Editorial Recommendation.</p> +<p>You will be informed shortly by email about the status of this Editorial Recommendation.</p> + +<p> + Sincerely, + <br> + The SciPost Team. +</p> diff --git a/templates/email/authors/inform_authors_eic_assigned_direct_rec.json b/templates/email/authors/inform_authors_eic_assigned_direct_rec.json new file mode 100644 index 0000000000000000000000000000000000000000..8d952bcb257fede2c6d20158fe25f078df5d1ed2 --- /dev/null +++ b/templates/email/authors/inform_authors_eic_assigned_direct_rec.json @@ -0,0 +1,8 @@ +{ + "subject": "SciPost: Editor assigned", + "to_address": "submitted_by.user.email", + "bcc_to": "edadmin@scipost.org", + "from_address_name": "SciPost Refereeing", + "from_address": "refereeing@scipost.org", + "context_object": "submission" +} diff --git a/templates/email/commenters/inform_commenter_comment_received.html b/templates/email/commenters/inform_commenter_comment_received.html new file mode 100644 index 0000000000000000000000000000000000000000..4f648aba05a3470f9bdda7871a4cbe8ece242a04 --- /dev/null +++ b/templates/email/commenters/inform_commenter_comment_received.html @@ -0,0 +1,32 @@ +<p>Dear {{comment.author.get_title_display}} {{comment.author.user.last_name}},</p> +<p> + We hereby confirm reception of your Comment, concerning + + <br/> + {{comment.core_content_object.title}} + {% if comment.core_content_object.author_list %} + <br> + by {{comment.core_content_object.author_list}}. + {% elif comment.core_content_object.author %} + <br> + by {{comment.core_content_object.author}}. + {% endif %} +</p> +<p> + We copy it below for your convenience. + <br> + Your Comment will soon be vetted, at which point you will receive an email update from us. +</p> +<p> + Thank you for your contribution,<br><br> + The SciPost Team. +</p> + +<br> +<p> + Comment: + <br> + {{ comment.comment_text|linebreaksbr }} +</p> + +{% include 'email/_footer.html' %} diff --git a/templates/email/commenters/inform_commenter_comment_received.json b/templates/email/commenters/inform_commenter_comment_received.json new file mode 100644 index 0000000000000000000000000000000000000000..d70d7953ed6e60d3f6c4dfb37383dba28fe481a9 --- /dev/null +++ b/templates/email/commenters/inform_commenter_comment_received.json @@ -0,0 +1,8 @@ +{ + "subject": "SciPost: Comment received", + "to_address": "author.user.email", + "bcc_to": "edadmin@scipost.org", + "from_address_name": "SciPost Comments", + "from_address": "edadmin@scipost.org", + "context_object": "comment" +} diff --git a/templates/email/eic/inform_eic_comment_received.html b/templates/email/eic/inform_eic_comment_received.html new file mode 100644 index 0000000000000000000000000000000000000000..b4e2c780466369e3196e6478cdb40ee125bd6de4 --- /dev/null +++ b/templates/email/eic/inform_eic_comment_received.html @@ -0,0 +1,19 @@ +<p>Dear {{ comment.core_content_object.editor_in_charge.get_title_display }} {{ comment.core_content_object.editor_in_charge.user.last_name }},</p> + +<p> + {{ comment.author.get_title_display }} {{ comment.author.user.last_name }} has delivered a Comment for Submission: +</p> +<p> + {{ comment.core_content_object.title }} + <br/> + by {{ comment.core_content_object.author_list }}. +</p> +<p> + 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> + The SciPost Team. +</p> + +{% include 'email/_footer.html' %} diff --git a/templates/email/eic/inform_eic_comment_received.json b/templates/email/eic/inform_eic_comment_received.json new file mode 100644 index 0000000000000000000000000000000000000000..90f695dc362f97df8a00f14d636d9f2de08681ec --- /dev/null +++ b/templates/email/eic/inform_eic_comment_received.json @@ -0,0 +1,8 @@ +{ + "subject": "SciPost: Comment delivered", + "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", + "context_object": "comment" +} diff --git a/templates/email/report_delivered_eic.html b/templates/email/eic/inform_eic_report_received.html similarity index 100% rename from templates/email/report_delivered_eic.html rename to templates/email/eic/inform_eic_report_received.html diff --git a/templates/email/eic/inform_eic_report_received.json b/templates/email/eic/inform_eic_report_received.json new file mode 100644 index 0000000000000000000000000000000000000000..a6ebfd554488bcca4b930d499b6b1124a7ab62fc --- /dev/null +++ b/templates/email/eic/inform_eic_report_received.json @@ -0,0 +1,8 @@ +{ + "subject": "SciPost: Report delivered", + "to_address": "submission.editor_in_charge.user.email", + "bcc_to": "edadmin@scipost.org", + "from_address_name": "SciPost Editorial Admin", + "from_address": "submissions@scipost.org", + "context_object": "report" +} diff --git a/templates/email/report_delivered_referee.html b/templates/email/referees/inform_referee_report_received.html similarity index 100% rename from templates/email/report_delivered_referee.html rename to templates/email/referees/inform_referee_report_received.html diff --git a/templates/email/referees/inform_referee_report_received.json b/templates/email/referees/inform_referee_report_received.json new file mode 100644 index 0000000000000000000000000000000000000000..300cb92e972cfa9438809bbff7211c26e8686440 --- /dev/null +++ b/templates/email/referees/inform_referee_report_received.json @@ -0,0 +1,8 @@ +{ + "subject": "SciPost: Report delivered", + "to_address": "author.user.email", + "bcc_to": "edadmin@scipost.org", + "from_address_name": "SciPost Editorial Admin", + "from_address": "submissions@scipost.org", + "context_object": "report" +} diff --git a/templates/email/report_delivered_eic.txt b/templates/email/report_delivered_eic.txt deleted file mode 100644 index dae336cd5874d192c31780ad5ddde5a4891839fa..0000000000000000000000000000000000000000 --- a/templates/email/report_delivered_eic.txt +++ /dev/null @@ -1,12 +0,0 @@ -Dear {{ report.submission.editor_in_charge.get_title_display }} {{ report.submission.editor_in_charge.user.last_name }}, - -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 }}. - -Please vet this Report via your personal page at -https://scipost.org{% url 'scipost:personal_page' %}, under the Editorial Actions tab. - -Many thanks in advance for your collaboration, -The SciPost Team. diff --git a/templates/email/report_delivered_referee.txt b/templates/email/report_delivered_referee.txt deleted file mode 100644 index 0f1ad9982bdd609c5a7b25feda58af55a8483714..0000000000000000000000000000000000000000 --- a/templates/email/report_delivered_referee.txt +++ /dev/null @@ -1,11 +0,0 @@ -Dear {{ report.author.get_title_display }} {{ report.author.user.last_name }}, - -We hereby confirm reception of your Report on Submission - -{{ report.submission.title }} -by {{ report.submission.author_list }}. - -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. - -Many thanks again, -The SciPost Team.