From 75ae29c1dd31ca1189fac1de7424cb81c1d67afb Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 4 Apr 2019 17:16:21 -0400 Subject: [PATCH] fix: #7470 Properly handle recompilation of email templates --- src/emailer.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/emailer.js b/src/emailer.js index b0706ad986..b75a672e88 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -344,9 +344,13 @@ function buildCustomTemplates(config) { }, next); }, function (result, next) { - var templates = result.templates.filter(function (template) { - return template.isCustom && template.text !== prevConfig['email:custom:' + path]; - }); + // If the new config contains any email override values, re-compile those templates + var toBuild = Object + .keys(config) + .filter(prop => prop.startsWith('email:custom:')) + .map(key => key.split(':')[2]); + + var templates = result.templates.filter(template => toBuild.includes(template.path)); var paths = _.fromPairs(result.paths.map(function (p) { var relative = path.relative(viewsDir, p).replace(/\\/g, '/'); return [relative, p];