Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix async/await in copy/move card operations#6120

Merged
xet7 merged 2 commits intowekan:mainfrom
harryadel:fix/issue-6105-async-copy-card
Jan 31, 2026
Merged

Fix async/await in copy/move card operations#6120
xet7 merged 2 commits intowekan:mainfrom
harryadel:fix/issue-6105-async-copy-card

Conversation

@harryadel
Copy link
Contributor

Fixes #6105 where card copy menu not displaying and custom fields validation errors on cross-board operations.

The mapCustomFieldsToBoard() method is async but was being called without await in both copy() and move() methods. This caused a Promise object to be assigned to customFields instead of the actual array, failing MongoDB schema validation on cross-board copy/move operations.

Additionally, the copyCard server method was synchronous but calling the now-async copy() method, and the client was using synchronous Meteor.call() for a server-only method which returns undefined immediately.


Since Card.copy() is now async, all callers in the copy chain needed updates:

  • models/lists.js: Made List.copy() async
  • models/swimlanes.js: Made Swimlane.copy() async
  • client/components/sidebar/sidebarFilters.js: Fixed mutateSelectedCards() to support async callbacks (also fixes pre-existing bug where copySelection was passing a callback but the function only accepted method names)
  • client/components/lists/listBody.js: Made template copy event handler async

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.
@harryadel harryadel marked this pull request as ready for review January 31, 2026 18:27
@xet7 xet7 merged commit bbd9fd8 into wekan:main Jan 31, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card copy menu is not displayed

2 participants