Skip to content

Commit e6fcf8e

Browse files
committed
Tweak for clarity
1 parent b57edf0 commit e6fcf8e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

plugins/output/adapt/importsource.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,20 @@ function ImportSource(req, done) {
349349
await Promise.all(plugindata.pluginIncludes.map(async ({ type, name }) => {
350350
const pluginQuery = await dbRetrieve(`${type}type`, { name });
351351
const plugin = pluginQuery[0]._doc;
352-
const pluginGlobals = plugin.globals;
353-
if (!pluginGlobals) return;
352+
const schemaGlobals = plugin.globals;
353+
if (!schemaGlobals) return;
354+
const schemaDefaults = {};
354355
const typeKey = type === 'component' || type === 'extension' ?
355356
`_${type}s` :
356357
`_${type}`;
357358
const pluginKey = `_${plugin[type]}`;
358359
if (!courseGlobals[typeKey]) {
359360
courseGlobals[typeKey] = {};
360361
}
361-
Object.entries(pluginGlobals).forEach(([key, value]) => {
362-
pluginGlobals[key] = value.default;
362+
Object.entries(schemaGlobals).forEach(([ key, value ]) => {
363+
schemaDefaults[key] = value.default;
363364
});
364-
courseGlobals[typeKey][pluginKey] = _.defaults(courseGlobals[typeKey][pluginKey], pluginGlobals);
365+
courseGlobals[typeKey][pluginKey] = _.defaults(courseGlobals[typeKey][pluginKey], schemaDefaults);
365366
}));
366367
await dbUpdate('course', { _id: courseId }, { _globals: courseGlobals });
367368
},

0 commit comments

Comments
 (0)