diff --git a/mod/workspace/getLayer.js b/mod/workspace/getLayer.js index 8aa9675d9..404bdfccd 100644 --- a/mod/workspace/getLayer.js +++ b/mod/workspace/getLayer.js @@ -33,21 +33,24 @@ module.exports = async (params) => { return new Error('Unable to validate layer param.') } - const layer = locale.layers[params.layer] + let layer = locale.layers[params.layer] // Assign key value as key on layer object. layer.key ??= params.layer if (Object.hasOwn(workspace.templates, layer.template || layer.key)) { - merge(layer, await getTemplate(workspace.templates[layer.template || layer.key])) + // Merge the workspace template into the layer. + layer = merge(await getTemplate(workspace.templates[layer.template || layer.key]), layer) } if (Array.isArray(layer.templates)) { // Merge templates from templates array into layer. layer.templates.forEach(async template => { - merge(layer, await getTemplate(workspace.templates[template])) + + // Merge the workspace template into the layer. + layer = merge(await getTemplate(workspace.templates[template]), layer) }) } diff --git a/mod/workspace/getLocale.js b/mod/workspace/getLocale.js index 0ef979cc0..ed21f7fdd 100644 --- a/mod/workspace/getLocale.js +++ b/mod/workspace/getLocale.js @@ -14,7 +14,7 @@ module.exports = async (params) => { return new Error('Unable to validate locale param.') } - const locale = workspace.locales[params.locale] + let locale = workspace.locales[params.locale] const roles = params.user?.roles || [] @@ -26,7 +26,7 @@ module.exports = async (params) => { if (Object.hasOwn(workspace.templates, params.locale)) { // Merge the workspace template into workspace. - merge(locale, await getTemplate(workspace.templates[params.locale])) + locale = merge(await getTemplate(workspace.templates[params.locale]), locale) } return locale diff --git a/mod/workspace/getTemplate.js b/mod/workspace/getTemplate.js index 5b7fcd2af..3418eecc8 100644 --- a/mod/workspace/getTemplate.js +++ b/mod/workspace/getTemplate.js @@ -55,7 +55,7 @@ module.exports = async (template) => { if (typeof response === 'object') { // Get template from src. - merge(template, response) + template = merge(response, template) } else if (typeof response === 'string') {