1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 13:19:44 +02:00

feat: fully rework 'move list to board' feature to match review requirements

- All async logic for moving lists between boards is now handled via Redux sagas, not in React components.
- Removed direct API calls and sessionStorage usage from UI.
- Added a unified action creator for moving lists between boards.
- Saga watcher now uses the correct action type constant.
- On the backend, the move-to-board helper now:
  - Detaches card members who are not present on the target board.
  - Converts board-wide custom fields to per-card fields when moving lists.
- Added selector memoization in BoardSelectStep to prevent unnecessary rerenders.
- All business logic is now outside of UI components.
- The feature now fully handles:
  - Users (members/assignees) who do not exist on the target board.
  - Board-wide custom fields, which are now either copied or converted to per-card fields.
- All review comments are addressed: no business logic in components, no sessionStorage, all edge cases handled, only sagas and request used for async actions.
This commit is contained in:
symonbaikov 2025-07-04 00:30:07 +03:00
parent 9c08ce51f1
commit 869d9c1d11
7 changed files with 99 additions and 22 deletions

View file

@ -58,6 +58,57 @@ module.exports = {
});
await Promise.all(migrateLabelsPromises);
await Promise.all(
updatedCards.map(async (card) => {
const cardMemberships = await CardMembership.find({ cardId: card.id });
await Promise.all(
cardMemberships.map(async (membership) => {
const userMembership = await BoardMembership.findOne({
boardId: inputs.targetBoard.id,
userId: membership.userId,
});
if (!userMembership) {
await CardMembership.destroy({ id: membership.id });
}
}),
);
}),
);
await Promise.all(
updatedCards.map(async (card) => {
const customFieldValues = await CustomFieldValue.find({ cardId: card.id });
await Promise.all(
customFieldValues.map(async (value) => {
const group = await CustomFieldGroup.findOne({ id: value.customFieldGroupId });
if (group && group.boardId && group.boardId !== inputs.targetBoard.id) {
const newGroup = await CustomFieldGroup.create({
name: group.name,
position: group.position,
cardId: card.id,
baseCustomFieldGroupId: group.baseCustomFieldGroupId,
}).fetch();
const field = await CustomField.findOne({ id: value.customFieldId });
const newField = await CustomField.create({
name: field.name,
position: field.position,
showOnFrontOfCard: field.showOnFrontOfCard,
customFieldGroupId: newGroup.id,
baseCustomFieldGroupId: field.baseCustomFieldGroupId,
}).fetch();
await CustomFieldValue.updateOne(
{ id: value.id },
{
customFieldGroupId: newGroup.id,
customFieldId: newField.id,
},
);
}
}),
);
}),
);
return {
updatedList,
updatedCards,