SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 4ac0567f authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Merge branch 'commentmail' into development

parents f214c6ff 8dc677ae
No related branches found
No related tags found
No related merge requests found
...@@ -25,8 +25,20 @@ class CommentUtils(BaseMailUtil): ...@@ -25,8 +25,20 @@ class CommentUtils(BaseMailUtil):
Requires loading: Requires loading:
comment -- Comment comment -- Comment
""" """
from submissions.models import Submission, Report
comment = cls._context['comment']
send_mail = True
if isinstance(comment.content_object, Submission):
send_mail = comment.author not in comment.content_object.authors.all()
elif isinstance(comment.content_object, Report):
send_mail = comment.author not in comment.content_object.submission.authors.all()
if not send_mail:
return
cls._send_mail(cls, 'comment_vet_accepted', cls._send_mail(cls, 'comment_vet_accepted',
[cls._context['comment'].author.user.email], [comment.author.user.email],
'SciPost Comment published') 'SciPost Comment published')
@classmethod @classmethod
......
...@@ -76,10 +76,6 @@ def vet_submitted_comment(request, comment_id): ...@@ -76,10 +76,6 @@ def vet_submitted_comment(request, comment_id):
comment.vetted_by = request.user.contributor comment.vetted_by = request.user.contributor
comment.save() comment.save()
# Send emails
CommentUtils.load({'comment': comment})
CommentUtils.email_comment_vet_accepted_to_author()
# Update `latest_activity` fields # Update `latest_activity` fields
content_object = comment.content_object content_object = comment.content_object
content_object.latest_activity = timezone.now() content_object.latest_activity = timezone.now()
...@@ -100,6 +96,10 @@ def vet_submitted_comment(request, comment_id): ...@@ -100,6 +96,10 @@ def vet_submitted_comment(request, comment_id):
SubmissionUtils.load({'submission': content_object.submission}) SubmissionUtils.load({'submission': content_object.submission})
SubmissionUtils.send_author_comment_received_email() SubmissionUtils.send_author_comment_received_email()
# Send emails
CommentUtils.load({'comment': comment})
CommentUtils.email_comment_vet_accepted_to_author()
elif form.cleaned_data['action_option'] == '2': elif form.cleaned_data['action_option'] == '2':
# The comment request is simply rejected # The comment request is simply rejected
comment.status = int(form.cleaned_data['refusal_reason']) comment.status = int(form.cleaned_data['refusal_reason'])
......
...@@ -70,6 +70,8 @@ class Submission(models.Model): ...@@ -70,6 +70,8 @@ class Submission(models.Model):
default=CYCLE_DEFAULT) default=CYCLE_DEFAULT)
fellows = models.ManyToManyField('colleges.Fellowship', blank=True, fellows = models.ManyToManyField('colleges.Fellowship', blank=True,
related_name='pool') related_name='pool')
# visible_pool = models.BooleanField(default=True)
# visible_public = models.BooleanField(default=False)
subject_area = models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS, subject_area = models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS,
verbose_name='Primary subject area', default='Phys:QP') verbose_name='Primary subject area', default='Phys:QP')
submission_type = models.CharField(max_length=10, choices=SUBMISSION_TYPE) submission_type = models.CharField(max_length=10, choices=SUBMISSION_TYPE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment