Fix async/await in copy/move card operations#6120
Merged
xet7 merged 2 commits intowekan:mainfrom Jan 31, 2026
Merged
Conversation
The mapCustomFieldsToBoard() method is async but was being called without await in copy() and move() methods. This caused a Promise to be assigned to customFields instead of the actual array, failing MongoDB schema validation on cross-board operations. Changes: - Make copy() method async and await mapCustomFieldsToBoard() - Add await in move() for mapCustomFieldsToBoard() - Make copyCard() server method async and await card.copy() - Add null check in mapCustomFieldsToBoard() for cards without custom fields - Update client to use Meteor.callAsync for server-only copyCard method Fixes wekan#6105
Since Card.copy() is now async, all callers in the copy chain need to be updated to properly await the async operations: - Make List.copy() async and await card.copy() in loop - Make Swimlane.copy() async and await list.copy() in loop - Fix mutateSelectedCards() to support async callbacks and method calls - Make template copy event handler async in listBody.js This also fixes the copySelection feature which was passing a callback to mutateSelectedCards() but the function only supported method names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6105 where card copy menu not displaying and custom fields validation errors on cross-board operations.
The
mapCustomFieldsToBoard()method isasyncbut was being called withoutawaitin bothcopy()andmove()methods. This caused a Promise object to be assigned tocustomFieldsinstead of the actual array, failing MongoDB schema validation on cross-board copy/move operations.Additionally, the
copyCardserver method was synchronous but calling the now-asynccopy()method, and the client was using synchronousMeteor.call()for a server-only method which returnsundefinedimmediately.Since
Card.copy()is now async, all callers in the copy chain needed updates:List.copy()asyncSwimlane.copy()asyncmutateSelectedCards()to support async callbacks (also fixes pre-existing bug where copySelection was passing a callback but the function only accepted method names)