mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 15:35:47 +01:00
closes #2183
This commit is contained in:
@@ -10,6 +10,7 @@ var fs = require('fs'),
|
||||
Plugins = require('./plugins'),
|
||||
meta = require('./meta'),
|
||||
translator = require('../public/src/modules/translator'),
|
||||
tjs = require('templates.js'),
|
||||
|
||||
app;
|
||||
|
||||
@@ -48,11 +49,11 @@ var fs = require('fs'),
|
||||
function renderAndTranslate(tpl, params, callback) {
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
app.render('emails/partials/footer' + (tpl.indexOf('_plaintext') !== -1 ? '_plaintext' : ''), params, next);
|
||||
render('emails/partials/footer' + (tpl.indexOf('_plaintext') !== -1 ? '_plaintext' : ''), params, next);
|
||||
},
|
||||
function(footer, next) {
|
||||
params.footer = footer;
|
||||
app.render(tpl, params, next);
|
||||
render(tpl, params, next);
|
||||
},
|
||||
function(html, next) {
|
||||
translator.translate(html, lang, function(translated) {
|
||||
@@ -62,6 +63,15 @@ var fs = require('fs'),
|
||||
], callback);
|
||||
}
|
||||
|
||||
function render(tpl, params, next) {
|
||||
if (meta.config['email:custom:' + tpl.replace('emails/', '')]) {
|
||||
var text = templates.parse(meta.config['email:custom:' + tpl.replace('emails/', '')], params);
|
||||
next(null, text);
|
||||
} else {
|
||||
app.render(tpl, params, next);
|
||||
}
|
||||
}
|
||||
|
||||
callback = callback || function() {};
|
||||
|
||||
if (!Plugins.hasListeners('action:email.send')) {
|
||||
|
||||
Reference in New Issue
Block a user