diff --git a/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js b/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js index b2d0f8e2614db48c467cfe5440c1c156332361ab..012113ffdbbd6df5542523b231860bdacaab7032 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js +++ b/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js @@ -68,6 +68,7 @@ module.exports = { email, baseUrl, titleText, + UserModel, fragmentHelper, subjectBaseText, }) diff --git a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js index ef6033c77ff3828f90d71c843fddf047d3f1aa58..f99bbd3b5c8ef78a1ed89ff6453df8945a1cc26f 100644 --- a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js +++ b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js @@ -340,13 +340,13 @@ const sendEiCEmail = ({ eicName, eicEmail, titleText, - recommendation, + recommendation: { recommendation, comments: recComments = [] }, subjectBaseText, }) => { let emailType email.content.subject = `${subjectBaseText} Recommendation` - switch (recommendation.recommendation) { + switch (recommendation) { case 'minor': case 'major': emailType = 'eic-request-revision-from-he' @@ -366,7 +366,7 @@ const sendEiCEmail = ({ name: eicName, } - const privateNote = recommendation.comments.find(comm => comm.private) + const privateNote = recComments.find(comm => comm.private) const content = get(privateNote, 'content') const comments = content ? `Note to Editor: "${content}"` : '' const { html, text } = email.getBody({ diff --git a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/post.js b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/post.js index 61b5cc07ca41eac18b8478acf375d291640defd3..37677984272615861c98b4d2b2b7f341078933f6 100644 --- a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/post.js +++ b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/post.js @@ -58,17 +58,18 @@ module.exports = models => async (req, res) => { newRecommendation.recommendation = recommendation || undefined newRecommendation.comments = comments || undefined - const collectionHelper = new Collection({ collection }) - collectionHelper.updateStatusOnRecommendation({ - isEditorInChief, - recommendation, - }) - - if (!isEditorInChief && ['minor', 'major'].includes(recommendation)) { - fragment.revision = pick(fragment, ['authors', 'files', 'metadata']) - } - if (recommendationType === 'editorRecommendation') { + const collectionHelper = new Collection({ collection }) + + collectionHelper.updateStatusOnRecommendation({ + isEditorInChief, + recommendation, + }) + + if (!isEditorInChief && ['minor', 'major'].includes(recommendation)) { + fragment.revision = pick(fragment, ['authors', 'files', 'metadata']) + } + notifications.sendNotifications({ fragment, collection,