Skip to content

Commit

Permalink
#3627 the email sent to editors when an author completes revisions is…
Browse files Browse the repository at this point in the history
… now a template and is logged correctly
  • Loading branch information
ajrbyers authored and mauromsl committed Sep 15, 2023
1 parent 742cc1d commit 8aeb782
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 11 deletions.
38 changes: 38 additions & 0 deletions src/utils/install/journal_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -4799,5 +4799,43 @@
"editable_by": [
"journal-manager"
]
},
{
"group": {
"name": "email"
},
"setting": {
"description": "Email sent editors when an author completes a revision request.",
"is_translatable": true,
"name": "revisions_complete_editor_notification",
"pretty_name": "Revisions Complete Editor Notification",
"type": "rich-text"
},
"value": {
"default": "<p>{{ revision.article.correspondence_author.full_name }} has successfully completed the assigned revision task for article #{{ revision.article.pk }} - \"{{ revision.article.title }}.\"</p><p>Please take a moment to review the revisions at {{ url }}.</p>"
},
"editable_by": [
"editor",
"journal-manager"
]
},
{
"group": {
"name": "email_subject"
},
"setting": {
"description": "Subject for Revisions Complete Editor Notification.",
"is_translatable": true,
"name": "subject_revisions_complete_editor_notification",
"pretty_name": "Subject for Revisions Complete Editor Notification",
"type": "char"
},
"value": {
"default": "Article Revisions Complete"
},
"editable_by": [
"editor",
"journal-manager"
]
}
]
38 changes: 27 additions & 11 deletions src/utils/transactional_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,26 +496,42 @@ def send_revisions_request(**kwargs):
def send_revisions_complete(**kwargs):
request = kwargs['request']
revision = kwargs['revision']
article = revision.article

action_text = ''
for action in revision.actions.all():
action_text = "{0}<br><br>{1} - {2}".format(action_text, action.logged, action.text)

description = ('<p>{0} has completed revisions for {1}</p> Actions:<br>{2}'
''.format(request.user.full_name(), revision.article.title, action_text)
''.format(request.user.full_name(), article.title, action_text)
)
notify_helpers.send_email_with_body_from_user(
request,
'subject_revisions_complete_receipt',
{editor.email for editor in get_assignment_editors(revision)},
description,
url = request.journal.site_url(
path=reverse(
'view_revision',
kwargs={
'article_id': article.pk,
'revision_id': revision.pk,
},
)
)
notify_helpers.send_slack(request, description, ['slack_editors'])

util_models.LogEntry.add_entry(
types='Revisions Complete', description=action_text, level='Info',
request=request, target=revision.article,
notify_helpers.send_email_with_body_from_setting_template(
request=request,
template='revisions_complete_editor_notification',
subject='subject_revisions_complete_editor_notification',
to={editor.email for editor in get_assignment_editors(revision)},
context={
'request': request,
'revision': revision,
'url': url,
},
log_dict={
'level': 'Info',
'action_text': description,
'types': 'Revisions Complete',
'target': article,
}
)
notify_helpers.send_slack(request, description, ['slack_editors'])


def send_revisions_author_receipt(**kwargs):
Expand Down

0 comments on commit 8aeb782

Please sign in to comment.