diff --git a/client/components/boards/boardArchive.js b/client/components/boards/boardArchive.js index dcbc66066..18ccf0b93 100644 --- a/client/components/boards/boardArchive.js +++ b/client/components/boards/boardArchive.js @@ -37,7 +37,7 @@ BlazeComponent.extendComponent({ await board.restore(); Utils.goBoardId(board._id); }, - 'click .js-delete-board': Popup.afterConfirm('boardDelete', function() { + 'click .js-delete-board': Popup.afterConfirm('boardDelete', async function() { Popup.back(); const isSandstorm = Meteor.settings && @@ -45,9 +45,9 @@ BlazeComponent.extendComponent({ Meteor.settings.public.sandstorm; if (isSandstorm && Utils.getCurrentBoardId()) { const currentBoard = Utils.getCurrentBoard(); - Boards.remove(currentBoard._id); + await Boards.removeAsync(currentBoard._id); } - Boards.remove(this._id); + await Boards.removeAsync(this._id); FlowRouter.go('home'); }), }, diff --git a/client/components/sidebar/sidebarArchives.js b/client/components/sidebar/sidebarArchives.js index 9b15897a9..e7f4adbb8 100644 --- a/client/components/sidebar/sidebarArchives.js +++ b/client/components/sidebar/sidebarArchives.js @@ -95,15 +95,15 @@ BlazeComponent.extendComponent({ } }, - 'click .js-delete-card': Popup.afterConfirm('cardDelete', function() { + 'click .js-delete-card': Popup.afterConfirm('cardDelete', async function() { const cardId = this._id; - Cards.remove(cardId); + await Cards.removeAsync(cardId); Popup.back(); }), - 'click .js-delete-all-cards': Popup.afterConfirm('cardDelete', () => { - this.archivedCards().forEach(card => { - Cards.remove(card._id); - }); + 'click .js-delete-all-cards': Popup.afterConfirm('cardDelete', async () => { + for (const card of this.archivedCards()) { + await Cards.removeAsync(card._id); + } Popup.back(); }), @@ -117,14 +117,14 @@ BlazeComponent.extendComponent({ } }, - 'click .js-delete-list': Popup.afterConfirm('listDelete', function() { - this.remove(); + 'click .js-delete-list': Popup.afterConfirm('listDelete', async function() { + await this.remove(); Popup.back(); }), - 'click .js-delete-all-lists': Popup.afterConfirm('listDelete', () => { - this.archivedLists().forEach(list => { - list.remove(); - }); + 'click .js-delete-all-lists': Popup.afterConfirm('listDelete', async () => { + for (const list of this.archivedLists()) { + await list.remove(); + } Popup.back(); }), @@ -140,17 +140,17 @@ BlazeComponent.extendComponent({ 'click .js-delete-swimlane': Popup.afterConfirm( 'swimlaneDelete', - function() { - this.remove(); + async function() { + await this.remove(); Popup.back(); }, ), 'click .js-delete-all-swimlanes': Popup.afterConfirm( 'swimlaneDelete', - () => { - this.archivedSwimlanes().forEach(swimlane => { - swimlane.remove(); - }); + async () => { + for (const swimlane of this.archivedSwimlanes()) { + await swimlane.remove(); + } Popup.back(); }, ), diff --git a/models/lists.js b/models/lists.js index 1b2307f04..a4489f6d3 100644 --- a/models/lists.js +++ b/models/lists.js @@ -339,8 +339,8 @@ Lists.helpers({ const card = ReactiveCache.getCard({ listId: this._id }); return card && card.originRelativeUrl(); }, - remove() { - Lists.remove({ _id: this._id }); + async remove() { + return await Lists.removeAsync({ _id: this._id }); }, async rename(title) { diff --git a/models/swimlanes.js b/models/swimlanes.js index 94347a62d..13f95df09 100644 --- a/models/swimlanes.js +++ b/models/swimlanes.js @@ -183,13 +183,13 @@ Swimlanes.helpers({ if (toList) { toListId = toList._id; } else { - toListId = Lists.insert({ + toListId = await Lists.insertAsync({ title: list.title, boardId: toBoardId, type: list.type, archived: false, wipLimit: list.wipLimit, - swimlaneId: toSwimlaneId, // Set the target swimlane for the copied list + swimlaneId: this._id, }); } @@ -202,7 +202,7 @@ Swimlanes.helpers({ } } - Swimlanes.update(this._id, { + await Swimlanes.updateAsync(this._id, { $set: { boardId: toBoardId, }, @@ -315,8 +315,8 @@ Swimlanes.helpers({ return (user.profile || {}).boardTemplatesSwimlaneId === this._id; }, - remove() { - Swimlanes.remove({ _id: this._id }); + async remove() { + return await Swimlanes.removeAsync({ _id: this._id }); }, async rename(title) {