Refactored sendNotification method to just use email address as parameter

This commit is contained in:
Nazar Gargol 2019-07-30 16:13:53 +02:00
parent 36026ab929
commit 8503bdceb8

View File

@ -82,16 +82,16 @@ async function doSettings(data, settingsAPI) {
return user;
}
function sendNotification(setupUser, mailAPI) {
const data = {
ownerEmail: setupUser.email
};
function sendNotification(email, mailAPI) {
if (config.get('sendWelcomeEmail')) {
const data = {
ownerEmail: email
};
return mail.utils.generateContent({data: data, template: 'welcome'})
.then((content) => {
const message = {
to: setupUser.email,
to: email,
subject: common.i18n.t('common.api.authentication.mail.yourNewGhostBlog'),
html: content.html,
text: content.text
@ -108,11 +108,8 @@ function sendNotification(setupUser, mailAPI) {
err.context = common.i18n.t('errors.api.authentication.unableToSendWelcomeEmail');
common.logging.error(err);
});
})
.return(setupUser);
});
}
return setupUser;
}
module.exports = {