diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/checklists.js | 13 | ||||
-rw-r--r-- | models/export.js | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/models/checklists.js b/models/checklists.js index 7ad9cae5..3b50cda6 100644 --- a/models/checklists.js +++ b/models/checklists.js @@ -276,6 +276,7 @@ if (Meteor.isServer) { * @param {string} boardId the board ID * @param {string} cardId the card ID * @param {string} title the title of the new checklist + * @param {string} [items] the list of items on the new checklist * @return_type {_id: string} */ JsonRoutes.add( @@ -291,11 +292,19 @@ if (Meteor.isServer) { sort: 0, }); if (id) { - req.body.items.forEach(function(item, idx) { + let items = req.body.items || []; + if (_.isString(items)) { + if (items === '') { + items = []; + } else { + items = [items]; + } + } + items.forEach(function(item, idx) { ChecklistItems.insert({ cardId: paramCardId, checklistId: id, - title: item.title, + title: item, sort: idx, }); }); diff --git a/models/export.js b/models/export.js index 056eefdc..cc979ce0 100644 --- a/models/export.js +++ b/models/export.js @@ -112,7 +112,7 @@ export class Exporter { ); result.subtaskItems.push( ...Cards.find({ - parentid: card._id, + parentId: card._id, }).fetch(), ); }); |