mirror of
https://github.com/wekan/wekan.git
synced 2026-11-07 02:52:33 -05:00
Copy/link rule actions (#4160, #3235), email attachments (#3948), custom-field rule values (#3195), GitLab sync (#2698), a scheduled due-date rule action (#4278) and more template variables (#3815) are each a real feature or need external infrastructure this sandbox cannot stand up, so they are recorded with their reasons rather than forced.
18 lines
790 B
JavaScript
18 lines
790 B
JavaScript
// #2184: optionally copy the parent card's CURRENT labelIds onto a new
|
|
// subtask, once, at creation time. This is a ONE-TIME copy, not an ongoing
|
|
// sync -- a later change to the parent's labels must never retroactively
|
|
// touch a subtask that was already created. Kept as a small pure function so
|
|
// it can be unit-tested without a database or a Meteor method call.
|
|
export function computeSubtaskLabelIds(parentCard, inheritLabels) {
|
|
if (!inheritLabels) {
|
|
return [];
|
|
}
|
|
const parentLabelIds =
|
|
parentCard && Array.isArray(parentCard.labelIds) ? parentCard.labelIds : [];
|
|
// Copy the array so later mutation of the parent's labelIds (by reference)
|
|
// can never leak into the already-created subtask.
|
|
return [...parentLabelIds];
|
|
}
|
|
|
|
export default computeSubtaskLabelIds;
|