mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
Rarely, moving a card from board A to board B left it half-moved: boardId became B but listId/swimlaneId still pointed at board A, so the card was invisible in every normal view on both boards and clicking it reopened A. Root cause: the Move/Copy dialog resolves the destination board's swimlanes/lists from the client Minimongo cache, which can still be empty when the user clicks Done (the destination board's publishComposite data has not merged yet) — leaving the source board's swimlaneId/listId while boardId is already the destination. setFirstSwimlaneId/setFirstListId swallow the cache miss in a silent try/catch. Other callers (drag, filter multi-move, rules, REST API) can produce the same mismatch. Fix: a new Cards.before.update guard (enforceCardBoardConsistency, registered first) rewrites the pending update on any boardId change so the swimlane/list always belong to the destination board, falling back to its default swimlane and first list. Runs server-side where the destination board's data is always present; corrective only (valid moves untouched, same-board reorders ignored). Decision logic extracted to a pure, dependency-injected module with a Meteor-free Node unit test including a negative test for the #5874 corrupt state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>