mirror of
https://github.com/wekan/wekan.git
synced 2026-11-07 11:02:33 -05:00
Beside the landing list, Board Settings / Subtasks now has a landing swimlane, stored as subtasksDefaultSwimlaneId. As with the list, the main board's choice wins on a shared deposit board, then the deposit board's own; a swimlane that is archived, gone or on another board is never used. With none picked, nothing changes: the swimlane with the parent card's swimlane title, else the default one (#2732). Changing the deposit board clears the choice, and a copied board does not keep its template's. models/lib/subtaskLandingSwimlane.js decides; tests/subtaskLandingSwimlane covers it, and tests/subtaskSwimlaneInheritance2732 now runs the chooser for the title match instead of reading the inline lookup it replaced. The two new strings are English placeholders until the next translation pass. Thanks to BjoernLudwig and xet7 ! Fixes #1953.
31 lines
1.4 KiB
JavaScript
31 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
// #4494 "Creating a board from a template breaks subtasks". Boards are created
|
|
// from a template by copying the template board. The copy inherited the
|
|
// template's subtasksDefaultBoardId / dateSettingsDefaultBoardId verbatim. When
|
|
// those pointed at the template board ITSELF (the common case — "subtasks live
|
|
// on this board"), subtasks created on the NEW board were dropped onto the
|
|
// TEMPLATE board, and the subtask card linked back across boards to the parent.
|
|
//
|
|
// remapCopiedBoardDefaults returns the $set patch that repoints any default
|
|
// board pointer referencing the source board to the copy instead. When a board
|
|
// pointer moves, its paired list pointer is cleared (null) because that list id
|
|
// belongs to the source board's lists; it self-heals to a list on the new
|
|
// board via Board.getDefaultSubtasksListId()/getDefaultDateSettingsListId().
|
|
// Meteor-free so it can be unit tested.
|
|
function remapCopiedBoardDefaults(board, oldId, newId) {
|
|
const patch = {};
|
|
if (board && board.subtasksDefaultBoardId === oldId) {
|
|
patch.subtasksDefaultBoardId = newId;
|
|
patch.subtasksDefaultListId = null;
|
|
patch.subtasksDefaultSwimlaneId = null;
|
|
}
|
|
if (board && board.dateSettingsDefaultBoardId === oldId) {
|
|
patch.dateSettingsDefaultBoardId = newId;
|
|
patch.dateSettingsDefaultListId = null;
|
|
}
|
|
return patch;
|
|
}
|
|
|
|
export { remapCopiedBoardDefaults };
|