Skip to content

Commit

Permalink
fix: #7470 Properly handle recompilation of email templates
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Apr 4, 2019
1 parent ae17481 commit 75ae29c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/emailer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 75ae29c

Please sign in to comment.