Skip to content
Snippets Groups Projects
Commit 084be2fe authored by Giannis Kopanas's avatar Giannis Kopanas
Browse files

fix(components): make use of email component

parent 22717c4e
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@
"config": "^1.26.1",
"lodash": "^4.17.5",
"moment": "^2.18.1",
"nodemailer": "^4.0.1"
"@pubsweet/component-send-email": "^0.2.2"
},
"devDependencies": {
"body-parser": "^1.17.2",
......
const { pick } = require('lodash')
const config = require('config')
const logger = require('@pubsweet/logger')
const emailer = require('@pubsweet/component-send-email')
const User = require('pubsweet-server/src/models/User')
const Fragment = require('pubsweet-server/src/models/Fragment')
const Collection = require('pubsweet-server/src/models/Collection')
const authsome = require('pubsweet-server/src/helpers/authsome')
const AuthorizationError = require('pubsweet-server/src/errors/AuthorizationError')
const transport = require('./transport')
module.exports = app => {
app.patch('/api/make-decision', async (req, res, next) => {
......@@ -98,7 +98,7 @@ module.exports = app => {
const authorEmails = authors.map(user => user.email)
logger.info(`Sending decision email to ${authorEmails}`)
await transport.sendMail({
await emailer.sendMail({
from: config.get('mailer.from'),
to: authorEmails,
subject: 'Decision made',
......
const config = require('config')
const nodemailer = require('nodemailer')
// SMTP transport options: https://nodemailer.com/smtp/
const options = config.get('mailer.transport')
module.exports = nodemailer.createTransport(options)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment