summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-09-30 13:18:08 +0300
committerLauri Ojansivu <x@xet7.org>2017-09-30 13:18:08 +0300
commit222c071925ecb62024092e3189deac644c5fd42e (patch)
tree64ed2ac272e1955cec1990b2ae964f00ce998995
parenteb945f26a3be316fb2ae4452d6db45a11f8b91d4 (diff)
parent0e3620c7760bd374d2eaf2ffc389368415f52302 (diff)
downloadwekan-222c071925ecb62024092e3189deac644c5fd42e.tar.gz
wekan-222c071925ecb62024092e3189deac644c5fd42e.tar.bz2
wekan-222c071925ecb62024092e3189deac644c5fd42e.zip
Merge branch 'GhassenRjab-feature/fix-trello-import' into devel
Fix errors when importing from Trello. Thanks to GhassenRjab ! Closes #1243, closes #1245
-rw-r--r--CHANGELOG.md8
-rw-r--r--models/trelloCreator.js45
2 files changed, 31 insertions, 22 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5a22e813..07356090 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:
diff --git a/models/trelloCreator.js b/models/trelloCreator.js
index e7f98e85..0f801ea3 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
@@ -398,27 +397,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}});
+ }
});
}