mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
Retain workflow categories and swimlane purpose, reset copied revisions and omit foreign planning links. Avoid mutating source container objects and preserve full-board transfer remapping. Thanks to xet7 !
16 lines
669 B
JavaScript
16 lines
669 B
JavaScript
'use strict';
|
|
|
|
// Standalone copies do not copy board planning records. Whole-board duplication
|
|
// defers metadata to the shared transfer remapper instead.
|
|
function copiedScrumMetadata(card, destinationBoardId, { omit = false } = {}) {
|
|
if (omit || !card.scrum) return {};
|
|
const scrum = { ...card.scrum };
|
|
if (Array.isArray(scrum.pastSprintIds)) scrum.pastSprintIds = [...scrum.pastSprintIds];
|
|
if (card.boardId !== destinationBoardId) {
|
|
for (const key of ['sprintId', 'pastSprintIds', 'releaseId', 'backlogRank']) delete scrum[key];
|
|
}
|
|
return { scrum, scrumRevision: 1 };
|
|
}
|
|
|
|
module.exports = { copiedScrumMetadata, copiedCardScrum: copiedScrumMetadata };
|