mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Ten modules were reached only from tests. Some were copies of production logic kept beside it, so a test passed whatever production did; the rest were re-export files that only tests imported. Copies removed, the test now reading what runs: - models/lib/oauth2ClientSecretJwt.js: wekan-oidc ran its own vendored copy. The package file is now the only one and tests/oauth2ClientSecretJwt drives it; tests/packageAppImportBoundary fails if a second copy returns. - models/lib/scrollbarCss.js (#5439): tests/scrollbarCss reads the rules in client/components/lists/list.css. - models/lib/createListParams.js: tests/createListParams reads the check() pattern of createListAfter in server/models/lists.js and runs it by the rules of Meteor's check, so changing the server pattern fails the test. - server/lib/cardMatch.js (#5910): the search is a Mongo selector in server/publications/cards.js, which tests/boardSearchComments now reads. - server/lib/dueDateEdits.js (#6081): Cards.getDueDateChangeCount() counts the a-dueAt activities itself. Helpers that production now calls: - models/lib/checklistHide.js (was server/lib): the Checklists helpers hideCheckedState() and isItemHidden() call it, with the same strict "checked is true" rule as before. - models/lib/subtaskSettings.js (was server/lib): the Board Settings subtask pickers mark the selected board and list with it. resolveSubtaskLanding(), which nothing called, is removed with its tests. Re-export files removed, the tests importing the real module: server/lib/listColors.js, cardScope.js, announcementVisibility.js, customNumberFormat.js and subtaskHelpers.js. docs/DeveloperDocs/Directory-Structure.md pointed at the migrations/ directory, which no longer exists; it now names server/migrations. Thanks to xet7 !
43 lines
1.5 KiB
JavaScript
43 lines
1.5 KiB
JavaScript
// Pure helpers for a board's "Subtasks" landing settings: which board and
|
|
// which list the Board Settings -> Subtasks pickers show as selected
|
|
// (client/components/sidebar/sidebar.js). Free of any Meteor / Mongo
|
|
// dependency so server/lib/tests/subtaskSettings.tests.js drives them directly.
|
|
//
|
|
// A board stores the landing target in three optional fields:
|
|
// - subtasksDefaultBoardId
|
|
// - subtasksDefaultListId
|
|
// - subtasksDefaultSwimlaneId (optional; may be undefined on older boards)
|
|
//
|
|
// A null, undefined, empty or "null" field is "not configured", and then no
|
|
// option is selected.
|
|
|
|
function isConfigured(value) {
|
|
return value !== null && value !== undefined && value !== '' && value !== 'null';
|
|
}
|
|
|
|
/**
|
|
* Whether the given listId is the board's configured subtasks landing list.
|
|
* Used by the "Landing list for subtasks deposited here" dropdown to mark the
|
|
* currently-selected option.
|
|
*
|
|
* @param {Object} board
|
|
* @param {*} listId
|
|
* @returns {boolean}
|
|
*/
|
|
export function isSelectedSubtaskList(board, listId) {
|
|
const b = board || {};
|
|
return isConfigured(b.subtasksDefaultListId) && b.subtasksDefaultListId === listId;
|
|
}
|
|
|
|
/**
|
|
* Whether the given boardId is the board's configured subtasks deposit board.
|
|
*
|
|
* @param {Object} board
|
|
* @param {*} boardId
|
|
* @returns {boolean}
|
|
*/
|
|
export function isSelectedSubtaskBoard(board, boardId) {
|
|
const b = board || {};
|
|
return isConfigured(b.subtasksDefaultBoardId) && b.subtasksDefaultBoardId === boardId;
|
|
}
|