Skip to content

Commit ca53f36

Browse files
committed
Revert to manual ContentPlugin.create without hooks
1 parent e6fcf8e commit ca53f36

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

plugins/output/adapt/importsource.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ function ImportSource(req, done) {
398398
delete data._latestTrackingId;
399399
data.createdBy = app.usermanager.getCurrentUser()._id;
400400
if(type !== 'course') {
401-
data._courseId = courseId.toString();
401+
data._courseId = courseId;
402402
}
403403
if(data._component) {
404404
data._componentType = metadata.componentMap[data._component]._id;
@@ -508,12 +508,15 @@ function ImportSource(req, done) {
508508
if (detachedElementsMap[originalData._id]) { // do not import detached elements
509509
return done();
510510
} // now we're ready to create the content
511-
app.contentmanager.create(type, data, function(error, record) {
512-
if(error) {
513-
logger.log('warn', 'Failed to import ' + type + ' ' + (originalData._id || '') + ' ' + error);
514-
return done();
515-
} // Create a courseAssets record if needed
516-
createCourseAssets(type, record, error => done(error, record));
511+
app.contentmanager.getContentPlugin(type, function(error, plugin) {
512+
if(error) return done(error);
513+
plugin.create(data, function(error, record) {
514+
if(error) {
515+
logger.log('warn', 'Failed to import ' + type + ' ' + (originalData._id || '') + ' ' + error);
516+
return done();
517+
} // Create a courseAssets record if needed
518+
createCourseAssets(type, record, error => done(error, record));
519+
});
517520
});
518521
});
519522
}

0 commit comments

Comments
 (0)