Propagate async/await to List.copy(), Swimlane.copy() and callers

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 commit is contained in:
Harry Adel 2026-01-31 19:46:22 +02:00
parent 14de981ac3
commit 35715ef2a3
4 changed files with 49 additions and 35 deletions

View file

@ -817,7 +817,7 @@ BlazeComponent.extendComponent({
evt.preventDefault();
this.term.set(evt.target.searchTerm.value);
},
'click .js-minicard'(evt) {
async 'click .js-minicard'(evt) {
// 0. Common
const title = $('.js-element-title')
.val()
@ -835,7 +835,7 @@ BlazeComponent.extendComponent({
if (this.isTemplateSearch) {
element.type = 'cardType-card';
element.linkedId = '';
_id = element.copy(this.boardId, this.swimlaneId, this.listId);
_id = await element.copy(this.boardId, this.swimlaneId, this.listId);
// 1.B Linked card
} else {
_id = element.link(this.boardId, this.swimlaneId, this.listId);
@ -847,13 +847,13 @@ BlazeComponent.extendComponent({
.lists()
.length;
element.type = 'list';
_id = element.copy(this.boardId, this.swimlaneId);
_id = await element.copy(this.boardId, this.swimlaneId);
} else if (this.isSwimlaneTemplateSearch) {
element.sort = ReactiveCache.getBoard(this.boardId)
.swimlanes()
.length;
element.type = 'swimlane';
_id = element.copy(this.boardId);
_id = await element.copy(this.boardId);
} else if (this.isBoardTemplateSearch) {
Meteor.call(
'copyBoard',