Removed unused 'cb' callback on send method of Email service and Email providers (#5371)

Signed-off-by: dacre-denny <dacre@mooce.co.nz>
This commit is contained in:
Dacre Denny 2020-03-21 02:02:47 +13:00 committed by GitHub
parent 7f3be5eb04
commit 45d83ea3f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 11 deletions

View File

@ -48,7 +48,7 @@ const getProviderConfig = async env => {
module.exports = { module.exports = {
getProviderConfig, getProviderConfig,
async send(options, config, cb) { async send(options, config) {
// Get email provider settings to configure the provider to use. // Get email provider settings to configure the provider to use.
if (!config) { if (!config) {
config = await getProviderConfig(strapi.config.environment); config = await getProviderConfig(strapi.config.environment);
@ -67,6 +67,6 @@ module.exports = {
const actions = await provider.init(config); const actions = await provider.init(config);
// Execute email function of the provider for all files. // Execute email function of the provider for all files.
return actions.send(options, cb); return actions.send(options);
}, },
}; };

View File

@ -44,13 +44,12 @@ module.exports = {
}); });
return { return {
send: (options, cb) => { send: options => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Default values. // Default values.
options = _.isObject(options) ? options : {}; options = _.isObject(options) ? options : {};
options.from = options.from || config.amazon_ses_default_from; options.from = options.from || config.amazon_ses_default_from;
options.replyTo = options.replyTo = options.replyTo || config.amazon_ses_default_replyto;
options.replyTo || config.amazon_ses_default_replyto;
options.text = options.text || options.html; options.text = options.text || options.html;
options.html = options.html || options.text; options.html = options.html || options.text;

View File

@ -44,7 +44,7 @@ module.exports = {
}); });
return { return {
send: (options, cb) => { send: options => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Default values. // Default values.
options = isObject(options) ? options : {}; options = isObject(options) ? options : {};

View File

@ -31,7 +31,7 @@ module.exports = {
sendgrid.setApiKey(config.sendgrid_api_key); sendgrid.setApiKey(config.sendgrid_api_key);
return { return {
send: (options, cb) => { send: options => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Default values. // Default values.
options = _.isObject(options) ? options : {}; options = _.isObject(options) ? options : {};

View File

@ -26,7 +26,7 @@ module.exports = {
}, },
init: config => { init: config => {
return { return {
send: (options, cb) => { send: options => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Default values. // Default values.
options = _.isObject(options) ? options : {}; options = _.isObject(options) ? options : {};
@ -47,9 +47,7 @@ module.exports = {
}, },
function(err) { function(err) {
if (err) { if (err) {
reject([ reject([{ messages: [{ id: 'Auth.form.error.email.invalid' }] }]);
{ messages: [{ id: 'Auth.form.error.email.invalid' }] },
]);
} else { } else {
resolve(); resolve();
} }