Update ReactiveCache call sites to use async/await for Meteor 3.0

Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async

Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
  checklists, checklistItems, customFields, attachments, integrations,
  cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
This commit is contained in:
Harry Adel 2026-02-01 00:54:38 +02:00
parent 2f6e34c5f5
commit 71eb01e233
81 changed files with 2218 additions and 2148 deletions

View file

@ -26,10 +26,10 @@ class DeleteDuplicateEmptyListsMigration {
/**
* Check if migration is needed for a board
*/
needsMigration(boardId) {
async needsMigration(boardId) {
try {
const lists = ReactiveCache.getLists({ boardId });
const cards = ReactiveCache.getCards({ boardId });
const lists = await ReactiveCache.getLists({ boardId });
const cards = await ReactiveCache.getCards({ boardId });
// Check if there are any empty lists that have a duplicate with the same title containing cards
for (const list of lists) {
@ -104,9 +104,9 @@ class DeleteDuplicateEmptyListsMigration {
* Convert shared lists (lists without swimlaneId) to per-swimlane lists
*/
async convertSharedListsToPerSwimlane(boardId) {
const lists = ReactiveCache.getLists({ boardId });
const swimlanes = ReactiveCache.getSwimlanes({ boardId, archived: false });
const cards = ReactiveCache.getCards({ boardId });
const lists = await ReactiveCache.getLists({ boardId });
const swimlanes = await ReactiveCache.getSwimlanes({ boardId, archived: false });
const cards = await ReactiveCache.getCards({ boardId });
let listsConverted = 0;
@ -206,8 +206,8 @@ class DeleteDuplicateEmptyListsMigration {
* 3. Have a duplicate list with the same title on the same board that contains cards
*/
async deleteEmptyPerSwimlaneLists(boardId) {
const lists = ReactiveCache.getLists({ boardId });
const cards = ReactiveCache.getCards({ boardId });
const lists = await ReactiveCache.getLists({ boardId });
const cards = await ReactiveCache.getCards({ boardId });
let listsDeleted = 0;
@ -268,8 +268,8 @@ class DeleteDuplicateEmptyListsMigration {
* Get detailed status of empty lists
*/
async getStatus(boardId) {
const lists = ReactiveCache.getLists({ boardId });
const cards = ReactiveCache.getCards({ boardId });
const lists = await ReactiveCache.getLists({ boardId });
const cards = await ReactiveCache.getCards({ boardId });
const sharedLists = [];
const emptyPerSwimlaneLists = [];
@ -319,30 +319,30 @@ const deleteDuplicateEmptyListsMigration = new DeleteDuplicateEmptyListsMigratio
// Register Meteor methods
Meteor.methods({
'deleteDuplicateEmptyLists.needsMigration'(boardId) {
async 'deleteDuplicateEmptyLists.needsMigration'(boardId) {
check(boardId, String);
if (!this.userId) {
throw new Meteor.Error('not-authorized', 'You must be logged in');
}
return deleteDuplicateEmptyListsMigration.needsMigration(boardId);
return await deleteDuplicateEmptyListsMigration.needsMigration(boardId);
},
'deleteDuplicateEmptyLists.execute'(boardId) {
async 'deleteDuplicateEmptyLists.execute'(boardId) {
check(boardId, String);
if (!this.userId) {
throw new Meteor.Error('not-authorized', 'You must be logged in');
}
// Check if user is board admin
const board = ReactiveCache.getBoard(boardId);
const board = await ReactiveCache.getBoard(boardId);
if (!board) {
throw new Meteor.Error('board-not-found', 'Board not found');
}
const user = ReactiveCache.getUser(this.userId);
const user = await ReactiveCache.getUser(this.userId);
if (!user) {
throw new Meteor.Error('user-not-found', 'User not found');
}
@ -356,17 +356,17 @@ Meteor.methods({
throw new Meteor.Error('not-authorized', 'Only board administrators can run migrations');
}
return deleteDuplicateEmptyListsMigration.executeMigration(boardId);
return await deleteDuplicateEmptyListsMigration.executeMigration(boardId);
},
'deleteDuplicateEmptyLists.getStatus'(boardId) {
async 'deleteDuplicateEmptyLists.getStatus'(boardId) {
check(boardId, String);
if (!this.userId) {
throw new Meteor.Error('not-authorized', 'You must be logged in');
}
return deleteDuplicateEmptyListsMigration.getStatus(boardId);
return await deleteDuplicateEmptyListsMigration.getStatus(boardId);
}
});