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

@ -196,7 +196,7 @@ Lists.allow({
});
Lists.helpers({
copy(boardId, swimlaneId) {
async copy(boardId, swimlaneId) {
const oldId = this._id;
const oldSwimlaneId = this.swimlaneId || null;
this.boardId = boardId;
@ -217,13 +217,16 @@ Lists.helpers({
}
// Copy all cards in list
ReactiveCache.getCards({
const cards = ReactiveCache.getCards({
swimlaneId: oldSwimlaneId,
listId: oldId,
archived: false,
}).forEach(card => {
card.copy(boardId, swimlaneId, _id);
});
for (const card of cards) {
await card.copy(boardId, swimlaneId, _id);
}
return _id;
},
async move(boardId, swimlaneId) {

View file

@ -147,7 +147,7 @@ Swimlanes.allow({
});
Swimlanes.helpers({
copy(boardId) {
async copy(boardId) {
const oldId = this._id;
const oldBoardId = this.boardId;
this.boardId = boardId;
@ -163,12 +163,15 @@ Swimlanes.helpers({
}
// Copy all lists in swimlane
ReactiveCache.getLists(query).forEach(list => {
const lists = ReactiveCache.getLists(query);
for (const list of lists) {
list.type = 'list';
list.swimlaneId = oldId;
list.boardId = boardId;
list.copy(boardId, _id);
});
await list.copy(boardId, _id);
}
return _id;
},
async move(toBoardId) {