Commit Graph
1 Commits
Author SHA1 Message Date
Lauri Ojansivu f4af25ee22 Extract the checklist-template append/copy document builders as pure functions, with tests.
models/lib/checklistTemplateCopy.js pulls the "copy a checklist/item
document onto another card" logic out of Checklists.copy() /
copyAllFromCardToCard() (#4017) into plain, Meteor-free functions -
the same split already used for subtask copying
(models/lib/subtaskCopy.js) and bulk checklist-item text editing
(models/lib/checklistItemsAsText.js) - so the copy semantics are unit
tested directly: the copy reproduces the source's checklist/item
content, drops the source _id (a fresh one is assigned on insert),
re-homes onto the destination card/board, places an appended checklist
after the target's own (existing checklists are read but never
mutated), and forces a copied item unchecked when resetChecked is set
while leaving the default (ordinary "Copy Checklist" / card copy)
behaviour unchanged. Checklists.copy() and copyAllFromCardToCard() now
call these builders instead of repeating the field-by-field copy
inline; behaviour is unchanged (the full node suite's existing
checklist tests still pass).

Thanks to Th0mas89 and xet7 !
2026-09-10 20:02:49 +03:00