FIX: Core templates should never overwrite theme/plugins (#12988)

This happened in Ember CLI due to a different script load order.
This commit is contained in:
Robin Ward 2021-05-07 14:41:06 -04:00 committed by GitHub
parent bc3c3d56e0
commit 225c0d2d96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,11 @@ import { getResolverOption } from "discourse-common/resolver";
export const __DISCOURSE_RAW_TEMPLATES = {};
export function addRawTemplate(name, template) {
export function addRawTemplate(name, template, opts = {}) {
// Core templates should never overwrite themes / plugins
if (opts.core && __DISCOURSE_RAW_TEMPLATES[name]) {
return;
}
__DISCOURSE_RAW_TEMPLATES[name] = template;
}

View File

@ -143,7 +143,7 @@ TemplateCompiler.prototype.processString = function (string, relativePath) {
");\n\n" +
'addRawTemplate("' +
filename +
'", template);\n' +
'", template, { core: true });\n' +
"export default template;"
);
};