v1.18.x
barisusakli 9 years ago
parent 75af978145
commit dbf0f279a2

@ -23,7 +23,7 @@ dashboardController.get = function(req, res, next) {
notDoneText:'Reload required' notDoneText:'Reload required'
}, },
{ {
done: plugins.hasListeners('action:email.send'), done: plugins.hasListeners('filter:email.send'),
doneText: 'Emailer Installed', doneText: 'Emailer Installed',
notDoneText:'Emailer not installed', notDoneText:'Emailer not installed',
tooltip:'Install an emailer plugin from the plugin page in order to activate registration emails and email digests', tooltip:'Install an emailer plugin from the plugin page in order to activate registration emails and email digests',

@ -79,7 +79,7 @@ Controllers.reset = function(req, res, next) {
Controllers.login = function(req, res, next) { Controllers.login = function(req, res, next) {
var data = {}, var data = {},
loginStrategies = require('../routes/authentication').getLoginStrategies(), loginStrategies = require('../routes/authentication').getLoginStrategies(),
emailersPresent = plugins.hasListeners('action:email.send'); emailersPresent = plugins.hasListeners('filter:email.send');
var registrationType = meta.config.registrationType || 'normal'; var registrationType = meta.config.registrationType || 'normal';

@ -74,8 +74,8 @@ var fs = require('fs'),
callback = callback || function() {}; callback = callback || function() {};
if (!Plugins.hasListeners('action:email.send')) { if (!Plugins.hasListeners('filter:email.send')) {
winston.warn('[emailer] No active email plugin found!'); winston.warn('[emailer] No active email plugin found to send "' + template + '" email');
return callback(); return callback();
} }
@ -110,11 +110,10 @@ var fs = require('fs'),
pid: params.pid, pid: params.pid,
fromUid: params.fromUid fromUid: params.fromUid
}; };
Plugins.fireHook('filter:email.send', data, next); Plugins.fireHook('filter:email.modify', data, next);
}, },
function (data, next) { function (data, next) {
Plugins.fireHook('action:email.send', data); Plugins.fireHook('filter:email.send', data, next);
next();
} }
], callback); ], callback);
}; };

@ -198,12 +198,11 @@ SocketAdmin.settings.clearSitemapCache = function(socket, data, callback) {
}; };
SocketAdmin.email.test = function(socket, data, callback) { SocketAdmin.email.test = function(socket, data, callback) {
if (plugins.hasListeners('action:email.send')) { if (plugins.hasListeners('filter:email.send')) {
emailer.send(data.template, socket.uid, { emailer.send(data.template, socket.uid, {
subject: '[NodeBB] Test Email', subject: '[NodeBB] Test Email',
site_title: meta.config.title || 'NodeBB' site_title: meta.config.title || 'NodeBB'
}); }, callback);
callback();
} else { } else {
callback(new Error('[[error:no-emailers-configured]]')); callback(new Error('[[error:no-emailers-configured]]'));
} }

@ -20,7 +20,7 @@ var async = require('async'),
return winston.verbose('[user/jobs] Did not send digests (' + interval + ') because subscription system is disabled.'); return winston.verbose('[user/jobs] Did not send digests (' + interval + ') because subscription system is disabled.');
} }
if (!plugins.hasListeners('action:email.send')) { if (!plugins.hasListeners('filter:email.send')) {
return winston.error('[user/jobs] Did not send digests (' + interval + ') because no active email plugin was found.'); return winston.error('[user/jobs] Did not send digests (' + interval + ') because no active email plugin was found.');
} }

@ -80,11 +80,8 @@ var async = require('async'),
if (plugins.hasListeners('action:user.verify')) { if (plugins.hasListeners('action:user.verify')) {
plugins.fireHook('action:user.verify', {uid: uid, data: data}); plugins.fireHook('action:user.verify', {uid: uid, data: data});
next(); next();
} else if (plugins.hasListeners('action:email.send')) {
emailer.send('welcome', uid, data, next);
} else { } else {
winston.warn('No emailer to send verification email!'); emailer.send('welcome', uid, data, next);
next();
} }
}); });
} }

@ -43,12 +43,7 @@ module.exports = function(User) {
template: 'invitation' template: 'invitation'
}; };
if (plugins.hasListeners('action:email.send')) { emailer.sendToEmail('invitation', email, meta.config.defaultLang, data, next);
emailer.sendToEmail('invitation', email, meta.config.defaultLang, data, next);
} else {
winston.warn('No emailer to send verification email!');
next();
}
}); });
} }
], callback); ], callback);

Loading…
Cancel
Save