From f883757552c839309a8072b6e97da1da3ee38d87 Mon Sep 17 00:00:00 2001 From: Ghassen Rjab Date: Tue, 26 Sep 2017 06:58:39 +0100 Subject: [PATCH 1/3] Ignore checklists with missing cards --- models/trelloCreator.js | 42 +++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/models/trelloCreator.js b/models/trelloCreator.js index e7f98e855..909128f02 100644 --- a/models/trelloCreator.js +++ b/models/trelloCreator.js @@ -398,27 +398,29 @@ export class TrelloCreator { createChecklists(trelloChecklists) { trelloChecklists.forEach((checklist) => { - // Create the checklist - const checklistToCreate = { - cardId: this.cards[checklist.idCard], - title: checklist.name, - createdAt: this._now(), - sort: checklist.pos, - }; - const checklistId = Checklists.direct.insert(checklistToCreate); - // keep track of Trello id => WeKan id - this.checklists[checklist.id] = checklistId; - // Now add the items to the checklist - const itemsToCreate = []; - checklist.checkItems.forEach((item) => { - itemsToCreate.push({ - _id: checklistId + itemsToCreate.length, - title: item.name, - isFinished: item.state === 'complete', - sort: item.pos, + if (this.cards[checklist.idCard]) { + // Create the checklist + const checklistToCreate = { + cardId: this.cards[checklist.idCard], + title: checklist.name, + createdAt: this._now(), + sort: checklist.pos, + }; + const checklistId = Checklists.direct.insert(checklistToCreate); + // keep track of Trello id => WeKan id + this.checklists[checklist.id] = checklistId; + // Now add the items to the checklist + const itemsToCreate = []; + checklist.checkItems.forEach((item) => { + itemsToCreate.push({ + _id: checklistId + itemsToCreate.length, + title: item.name, + isFinished: item.state === 'complete', + sort: item.pos, + }); }); - }); - Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}}); + Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}}); + } }); } From 109cd08151a26165bd63c132b37a00cc164c8491 Mon Sep 17 00:00:00 2001 From: Ghassen Rjab Date: Wed, 27 Sep 2017 22:23:55 +0100 Subject: [PATCH 2/3] Use a default color (black) for labels from Trello --- models/trelloCreator.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/trelloCreator.js b/models/trelloCreator.js index 909128f02..0f801ea36 100644 --- a/models/trelloCreator.js +++ b/models/trelloCreator.js @@ -113,7 +113,6 @@ export class TrelloCreator { check(trelloLabels, [Match.ObjectIncluding({ // XXX refine control by validating 'color' against a list of allowed // values (is it worth the maintenance?) - color: String, name: String, })]); } @@ -184,7 +183,7 @@ export class TrelloCreator { trelloBoard.labels.forEach((label) => { const labelToCreate = { _id: Random.id(6), - color: label.color, + color: label.color ? label.color : 'black', name: label.name, }; // We need to remember them by Trello ID, as this is the only ref we have From 0e3620c7760bd374d2eaf2ffc389368415f52302 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sat, 30 Sep 2017 13:17:40 +0300 Subject: [PATCH 3/3] Fix errors when importing from Trello. Thanks to GhassenRjab ! Closes #1243, closes #1245 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a22e813b..073560900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# Upcoming Wekan release + +This release fixes the following bugs: + +* [Fix errors when importing from Trello](https://github.com/wekan/wekan/pull/1259). + +Thanks to GitHub user GhassenRjab for contributions. + # v0.43 2017-09-25 Wekan release This release fixes the following bugs: