SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 9ce6faea authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Corrected emailing bugs in views

parent e2a58251
No related branches found
No related tags found
No related merge requests found
......@@ -75,21 +75,21 @@ def vet_commentary_request_ack(request, commentary_id):
# accept the commentary as is
commentary.vetted = True
commentary.save()
email_text = 'Dear ' + title_dict[commentary.requested_by.title] + ' ' + commentary.requested_by.user.last_name + ', \n\n The Commentary Page you have requested, concerning publication with title ' + commentary.pub_title + ' by ' + commentary.author_list + ', has been activated. You are now welcome to submit your comments.' + '\n\nThank you for your contribution, \nThe SciPost Team.'
email_text = 'Dear ' + title_dict[commentary.requested_by.title] + ' ' + commentary.requested_by.user.last_name + ', \n\nThe Commentary Page you have requested, concerning publication with title ' + commentary.pub_title + ' by ' + commentary.author_list + ', has been activated. You are now welcome to submit your comments.' + '\n\nThank you for your contribution, \nThe SciPost Team.'
emailmessage = EmailMessage('SciPost Commentary Page activated', email_text, 'commentaries@scipost.org', [commentary.requested_by.user.email, 'commentaries@scipost.org'], reply_to=['commentaries@scipost.org'])
emailmessage.send(fail_silently=False)
elif form.cleaned_data['action_option'] == '0':
# re-edit the form starting from the data provided
form2 = RequestCommentaryForm(initial={'pub_title': commentary.pub_title, 'arxiv_link': commentary.arxiv_link, 'pub_DOI_link': commentary.pub_DOI_link, 'author_list': commentary.author_list, 'pub_date': commentary.pub_date, 'pub_abstract': commentary.pub_abstract})
commentary.delete()
email_text = 'Dear ' + title_dict[commentary.requested_by.title] + ' ' + commentary.requested_by.user.last_name + ', \n\n The Commentary Page you have requested, concerning publication with title ' + commentary.pub_title + ' by ' + commentary.author_list + ', has been activated (with slight modifications to your submitted details). You are now welcome to submit your comments.' + '\n\nThank you for your contribution, \nThe SciPost Team.'
email_text = 'Dear ' + title_dict[commentary.requested_by.title] + ' ' + commentary.requested_by.user.last_name + ', \n\nThe Commentary Page you have requested, concerning publication with title ' + commentary.pub_title + ' by ' + commentary.author_list + ', has been activated (with slight modifications to your submitted details). You are now welcome to submit your comments.' + '\n\nThank you for your contribution, \nThe SciPost Team.'
emailmessage = EmailMessage('SciPost Commentary Page activated', email_text, 'commentaries@scipost.org', [commentary.requested_by.user.email, 'commentaries@scipost.org'], reply_to=['commentaries@scipost.org'])
emailmessage.send(fail_silently=False)
context = {'form': form2 }
return render(request, 'commentaries/request_commentary.html', context)
elif form.cleaned_data['action_option'] == '2':
# the commentary request is simply rejected
email_text = 'Dear ' + title_dict[commentary.requested_by.title] + ' ' + commentary.requested_by.user.last_name + ', \n\n The Commentary Page you have requested, concerning publication with title ' + commentary.pub_title + ' by ' + commentary.author_list + ', has not been activated for the following reason: ' + form.cleaned_data['refusal_reason'] + '.\n\nThank you for your interest, \nThe SciPost Team.'
email_text = 'Dear ' + title_dict[commentary.requested_by.title] + ' ' + commentary.requested_by.user.last_name + ', \n\nThe Commentary Page you have requested, concerning publication with title ' + commentary.pub_title + ' by ' + commentary.author_list + ', has not been activated for the following reason: ' + form.cleaned_data['refusal_reason'] + '.\n\nThank you for your interest, \nThe SciPost Team.'
if form.cleaned_data['email_response_field']:
email_text += '\n\nFurther explanations: ' + form.cleaned_data['email_response_field']
emailmessage = EmailMessage('SciPost Commentary Page activated', email_text, 'commentaries@scipost.org', [commentary.requested_by.user.email, 'commentaries@scipost.org'], reply_to=['comentaries@scipost.org'])
......
......@@ -37,11 +37,11 @@ def vet_submitted_comment_ack(request, comment_id):
# accept the comment as is
comment.status = 1
comment.save()
email_text = 'Dear ' + comment.author.title + ' ' + comment.author.last_name + ', \n\n The Comment you have submitted, concerning publication with title '
email_text = 'Dear ' + comment.author.title + ' ' + comment.author.user.last_name + ', \n\nThe Comment you have submitted, concerning publication with title '
if comment.commentary is not None:
email_text + comment.commentary.pub_title + ' by ' + comment.commentary.author_list
email_text += comment.commentary.pub_title + ' by ' + comment.commentary.author_list
elif comment.submission is not None:
email_text + comment.submission.title + ' by ' + comment.submission.author_list
email_text += comment.submission.title + ' by ' + comment.submission.author_list
email_text += ', has been accepted and published online.' + '\n\nThank you for your contribution, \nThe SciPost Team.'
emailmessage = EmailMessage('SciPost Comment published', email_text, 'noreply@scipost.org', ['jscaux@gmail.com'], reply_to=['J.S.Caux@uva.nl'])
emailmessage.send(fail_silently=False)
......@@ -51,9 +51,9 @@ def vet_submitted_comment_ack(request, comment_id):
comment.save()
email_text = 'The Comment you have submitted, concerning publication with title '
if comment.commentary is not None:
email_text + comment.commentary.pub_title + ' by ' + comment.commentary.author_list
email_text += comment.commentary.pub_title + ' by ' + comment.commentary.author_list
elif comment.submission is not None:
email_text + comment.submission.title + ' by ' + comment.submission.author_list
email_text += comment.submission.title + ' by ' + comment.submission.author_list
email_text += ', has been rejected for the following reason:' + form.cleaned_data['refusal_reason'] + '.\n\nThank you for your contribution, \nThe SciPost Team.'
if form.cleaned_data['email_response_field']:
email_text += '\n\nFurther explanations: ' + form.cleaned_data['email_response_field']
......@@ -162,9 +162,9 @@ def vet_author_reply_ack(request, reply_id):
reply.save()
email_text = 'The Author Reply you have submitted, concerning publication with title '
if reply.commentary is not None:
email_text + reply.commentary.pub_title + ' by ' + reply.commentary.author_list
email_text += reply.commentary.pub_title + ' by ' + reply.commentary.author_list
elif reply.submission is not None:
email_text + reply.submission.title + ' by ' + reply.submission.author_list
email_text += reply.submission.title + ' by ' + reply.submission.author_list
email_text += ', has been accepted and published online.' + '\n\nThank you for your contribution, \nThe SciPost Team.'
emailmessage = EmailMessage('SciPost Author Reply published', email_text, 'noreply@scipost.org', ['jscaux@gmail.com'], reply_to=['J.S.Caux@uva.nl'])
emailmessage.send(fail_silently=False)
......@@ -174,9 +174,9 @@ def vet_author_reply_ack(request, reply_id):
reply.save()
email_text = 'The Author Reply you have submitted, concerning publication with title '
if reply.commentary is not None:
email_text + reply.commentary.pub_title + ' by ' + reply.commentary.author_list
email_text += reply.commentary.pub_title + ' by ' + reply.commentary.author_list
elif reply.submission is not None:
email_text + reply.submission.title + ' by ' + reply.submission.author_list
email_text += reply.submission.title + ' by ' + reply.submission.author_list
email_text += ', has been rejected for the following reason:' + form.cleaned_data['refusal_reason'] + '.\n\nThank you for your contribution, \nThe SciPost Team.'
if form.cleaned_data['email_response_field']:
email_text += '\n\nFurther explanations: ' + form.cleaned_data['email_response_field']
......
......@@ -14,15 +14,12 @@ from .forms import *
def vote_on_commentary(request, commentary_id):
commentary = get_object_or_404(Commentary, pk=commentary_id)
rater = Contributor.objects.get(user=request.user)
if request.method == 'POST':
form = CommentaryRatingForm(request.POST)
if form.is_valid():
# if rater.id != report.author.id:
# Any previous rating from this contributor for this report is deleted:
CommentaryRating.objects.filter(rater=rater, commentary=commentary).delete()
newrating = CommentaryRating (
......
......@@ -35,7 +35,6 @@ def description(request):
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'filename="SciPost_Description.pdf"'
return response
# return HttpResponse("scipost/SciPost_Description.pdf", content_type="application/pdf")
def peer_witnessed_refereeing(request):
return render(request, 'scipost/peer_witnessed_refereeing.html')
......
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