feat: new hook `filter:email.prepare`

v1.18.x
Julian Lam 4 years ago
parent bf90d15881
commit 27ea3dcb2f

@ -216,7 +216,8 @@ Emailer.send = async (template, uid, params) => {
throw Error('[emailer] App not ready!'); throw Error('[emailer] App not ready!');
} }
const userData = await User.getUserFields(uid, ['email', 'username', 'email:confirmed']); let userData = await User.getUserFields(uid, ['email', 'username', 'email:confirmed']);
({ template, userData, params } = await Plugins.hooks.fire('filter:email.prepare', { template, userData, params }));
if (!userData || !userData.email) { if (!userData || !userData.email) {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
winston.warn(`uid : ${uid} has no email, not sending "${template}" email.`); winston.warn(`uid : ${uid} has no email, not sending "${template}" email.`);

Loading…
Cancel
Save