File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -305,9 +305,21 @@ function validateCourse(data, cb) {
305305
306306function iterateThroughChildren ( parents , children ) {
307307 let errors = '' ;
308+ if ( typeof parents === 'undefined' ) return errors ;
309+
308310 parents . forEach ( parent => {
309311 let parentType = app . polyglot . t ( 'app.' + parent . _type , 1 ) ;
310312 let childType = app . polyglot . t ( 'app.children' ) ;
313+
314+ if ( typeof children === 'undefined' ) {
315+ errors += app . polyglot . t ( 'app.doesnotcontain' , {
316+ type : parentType [ 0 ] . toUpperCase ( ) + parentType . slice ( 1 ) ,
317+ title : parent . title ,
318+ childType : childType
319+ } ) + '\n' ;
320+ return ;
321+ }
322+
311323 if ( children [ 0 ] && children [ 0 ] . _type ) childType = app . polyglot . t ( 'app.' + children [ 0 ] . _type , 0 ) ;
312324 let found = children . find ( child => JSON . stringify ( child . _parentId ) === JSON . stringify ( parent . _id ) ) ;
313325
You can’t perform that action at this time.
0 commit comments