mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Copy custom fields to new board
This commit is contained in:
parent
484276b80d
commit
27d05ee828
1 changed files with 19 additions and 0 deletions
|
|
@ -518,6 +518,25 @@ Boards.helpers({
|
||||||
swimlane.type = 'swimlane';
|
swimlane.type = 'swimlane';
|
||||||
swimlane.copy(_id);
|
swimlane.copy(_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// copy custom field definitions
|
||||||
|
const cfMap = {};
|
||||||
|
CustomFields.find({ boardIds: oldId }).forEach(cf => {
|
||||||
|
const id = cf._id;
|
||||||
|
delete cf._id;
|
||||||
|
cf.boardIds = [_id];
|
||||||
|
cfMap[id] = CustomFields.insert(cf);
|
||||||
|
});
|
||||||
|
Cards.find({ boardId: _id }).forEach(card => {
|
||||||
|
Cards.update(card._id, {
|
||||||
|
$set: {
|
||||||
|
customFields: card.customFields.map(cf => {
|
||||||
|
cf._id = cfMap[cf._id];
|
||||||
|
return cf;
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Is supplied user authorized to view this board?
|
* Is supplied user authorized to view this board?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue