Use Benchpress (#5901)

* Use Benchpress

* Use Benchpress.compileParse

* Error for template load failure

* Use benchpressjs package

* Compile templates on demand

* Fix user settings page

* Fix admin search to exclude `.jst` files

* Fix 500-embed

So ajaxify can still show an error if the server goes down
This commit is contained in:
Peter Jaszkowiak
2017-08-24 17:26:50 -06:00
committed by Barış Soner Uşaklı
parent 864321f727
commit abffc29128
16 changed files with 128 additions and 55 deletions

View File

@@ -3,7 +3,7 @@
var async = require('async');
var winston = require('winston');
var nconf = require('nconf');
var templates = require('templates.js');
var Benchpress = require('benchpressjs');
var nodemailer = require('nodemailer');
var sendmailTransport = require('nodemailer-sendmail-transport');
var smtpTransport = require('nodemailer-smtp-transport');
@@ -173,9 +173,9 @@ Emailer.sendViaFallback = function (data, 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);
var customTemplate = meta.config['email:custom:' + tpl.replace('emails/', '')];
if (customTemplate) {
Benchpress.compileParse(customTemplate, params, next);
} else {
app.render(tpl, params, next);
}