Merge pull request #3451 from jrsupplee/copy-custom-fields

Copy custom fields to new board
This commit is contained in:
Lauri Ojansivu 2021-01-20 18:08:35 +02:00 committed by GitHub
commit bafda03fd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -518,6 +518,25 @@ Boards.helpers({
swimlane.type = 'swimlane';
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?