mirror of
https://github.com/wekan/wekan.git
synced 2026-02-18 05:58:07 +01:00
Merge branch 'GhassenRjab-feature/fix-trello-import' into devel
Fix errors when importing from Trello. Thanks to GhassenRjab ! Closes #1243, closes #1245
This commit is contained in:
commit
222c071925
2 changed files with 31 additions and 22 deletions
|
|
@ -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
|
# v0.43 2017-09-25 Wekan release
|
||||||
|
|
||||||
This release fixes the following bugs:
|
This release fixes the following bugs:
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,6 @@ export class TrelloCreator {
|
||||||
check(trelloLabels, [Match.ObjectIncluding({
|
check(trelloLabels, [Match.ObjectIncluding({
|
||||||
// XXX refine control by validating 'color' against a list of allowed
|
// XXX refine control by validating 'color' against a list of allowed
|
||||||
// values (is it worth the maintenance?)
|
// values (is it worth the maintenance?)
|
||||||
color: String,
|
|
||||||
name: String,
|
name: String,
|
||||||
})]);
|
})]);
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +183,7 @@ export class TrelloCreator {
|
||||||
trelloBoard.labels.forEach((label) => {
|
trelloBoard.labels.forEach((label) => {
|
||||||
const labelToCreate = {
|
const labelToCreate = {
|
||||||
_id: Random.id(6),
|
_id: Random.id(6),
|
||||||
color: label.color,
|
color: label.color ? label.color : 'black',
|
||||||
name: label.name,
|
name: label.name,
|
||||||
};
|
};
|
||||||
// We need to remember them by Trello ID, as this is the only ref we have
|
// 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) {
|
createChecklists(trelloChecklists) {
|
||||||
trelloChecklists.forEach((checklist) => {
|
trelloChecklists.forEach((checklist) => {
|
||||||
// Create the checklist
|
if (this.cards[checklist.idCard]) {
|
||||||
const checklistToCreate = {
|
// Create the checklist
|
||||||
cardId: this.cards[checklist.idCard],
|
const checklistToCreate = {
|
||||||
title: checklist.name,
|
cardId: this.cards[checklist.idCard],
|
||||||
createdAt: this._now(),
|
title: checklist.name,
|
||||||
sort: checklist.pos,
|
createdAt: this._now(),
|
||||||
};
|
sort: checklist.pos,
|
||||||
const checklistId = Checklists.direct.insert(checklistToCreate);
|
};
|
||||||
// keep track of Trello id => WeKan id
|
const checklistId = Checklists.direct.insert(checklistToCreate);
|
||||||
this.checklists[checklist.id] = checklistId;
|
// keep track of Trello id => WeKan id
|
||||||
// Now add the items to the checklist
|
this.checklists[checklist.id] = checklistId;
|
||||||
const itemsToCreate = [];
|
// Now add the items to the checklist
|
||||||
checklist.checkItems.forEach((item) => {
|
const itemsToCreate = [];
|
||||||
itemsToCreate.push({
|
checklist.checkItems.forEach((item) => {
|
||||||
_id: checklistId + itemsToCreate.length,
|
itemsToCreate.push({
|
||||||
title: item.name,
|
_id: checklistId + itemsToCreate.length,
|
||||||
isFinished: item.state === 'complete',
|
title: item.name,
|
||||||
sort: item.pos,
|
isFinished: item.state === 'complete',
|
||||||
|
sort: item.pos,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
||||||
Checklists.direct.update(checklistId, {$set: {items: itemsToCreate}});
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue