Skip to content

Commit dcabdc4

Browse files
committed
Switch to ContentManager.create
1 parent 739578c commit dcabdc4

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

plugins/output/adapt/importsource.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ function ImportSource(req, done) {
372372
delete data._latestTrackingId;
373373
data.createdBy = app.usermanager.getCurrentUser()._id;
374374
if(type !== 'course') {
375-
data._courseId = courseId;
375+
data._courseId = courseId.toString();
376376
}
377377
if(data._component) {
378378
data._componentType = metadata.componentMap[data._component]._id;
@@ -482,15 +482,12 @@ function ImportSource(req, done) {
482482
if (detachedElementsMap[originalData._id]) { // do not import detached elements
483483
return done();
484484
} // now we're ready to create the content
485-
app.contentmanager.getContentPlugin(type, function(error, plugin) {
486-
if(error) return done(error);
487-
plugin.create(data, function(error, record) {
488-
if(error) {
489-
logger.log('warn', 'Failed to import ' + type + ' ' + (originalData._id || '') + ' ' + error);
490-
return done();
491-
} // Create a courseAssets record if needed
492-
createCourseAssets(type, record, error => done(error, record));
493-
});
485+
app.contentmanager.create(type, data, function(error, record) {
486+
if(error) {
487+
logger.log('warn', 'Failed to import ' + type + ' ' + (originalData._id || '') + ' ' + error);
488+
return done();
489+
} // Create a courseAssets record if needed
490+
createCourseAssets(type, record, error => done(error, record));
494491
});
495492
});
496493
}

0 commit comments

Comments
 (0)