mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
Preserve previous-source cards across project switches, require matching credentials before fetching, and bind identifiable legacy mappings before replacing or clearing settings. Reject unknown legacy sources and stale fetched configurations. Verify with nine focused Node suites, nine Chromium scenarios and the local release audit. Concurrent jobs and configuration writes remain nontransactional. Thanks to xet7 !
42 lines
1.7 KiB
JavaScript
42 lines
1.7 KiB
JavaScript
'use strict';
|
|
import { copiedCardScrum } from './scrumCopy.js';
|
|
|
|
// #3185 "Template with subtasks and checklists". When a card is copied (e.g.
|
|
// generating a card from a template), each subtask was inserted as a BARE card
|
|
// document — its checklists (and their items) were never copied, so the new
|
|
// card's subtasks came out empty. The parent card's own checklists were copied,
|
|
// but the per-subtask copy skipped them.
|
|
//
|
|
// buildCopiedSubtaskFields() builds the card document for a copied subtask
|
|
// (re-homed under the new parent and onto the destination board), and
|
|
// subtaskCopyChildKinds() declares the child records a subtask copy must also
|
|
// reproduce — 'checklists' being the one that was missing in #3185. Meteor-free
|
|
// so the re-homing and the copy contract are unit tested; the caller then runs
|
|
// Checklist.copy() for each kind.
|
|
function buildCopiedSubtaskFields(subtask, { newParentId, boardId, swimlaneId, listId } = {}) {
|
|
const fields = Object.assign({}, subtask);
|
|
delete fields._id;
|
|
delete fields.__id;
|
|
delete fields.syncExternalId;
|
|
delete fields.syncSourceType;
|
|
delete fields.syncLastSource;
|
|
delete fields.syncSourceKey;
|
|
delete fields.scrum;
|
|
delete fields.scrumRevision;
|
|
Object.assign(fields, copiedCardScrum(subtask, boardId));
|
|
fields.parentId = newParentId;
|
|
fields.boardId = boardId;
|
|
fields.swimlaneId = swimlaneId;
|
|
fields.listId = listId;
|
|
return fields;
|
|
}
|
|
|
|
// The child-record kinds a full subtask copy must reproduce. Guards #3185: a
|
|
// subtask copy that reproduces only the card (this list empty / missing
|
|
// 'checklists') is the regression.
|
|
function subtaskCopyChildKinds() {
|
|
return ['checklists'];
|
|
}
|
|
|
|
export { buildCopiedSubtaskFields, subtaskCopyChildKinds };
|