Fix opening board migration of Shared Lists to Per-Swimlane lists to use ReactiveCache correctly without errors.

Thanks to xet7 !

Fixes #5960
This commit is contained in:
Lauri Ojansivu 2025-10-21 10:43:53 +03:00
parent 678ca978a3
commit 9536e60bd1

View file

@ -18,6 +18,9 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check'; import { check } from 'meteor/check';
import { ReactiveCache } from '/imports/reactiveCache'; import { ReactiveCache } from '/imports/reactiveCache';
import Boards from '/models/boards';
import Lists from '/models/lists';
import Cards from '/models/cards';
class FixMissingListsMigration { class FixMissingListsMigration {
constructor() { constructor() {
@ -158,7 +161,7 @@ class FixMissingListsMigration {
if (originalList.collapsed) newListData.collapsed = originalList.collapsed; if (originalList.collapsed) newListData.collapsed = originalList.collapsed;
// Insert the new list // Insert the new list
const newListId = ReactiveCache.getCollection('lists').insert(newListData); const newListId = Lists.insert(newListData);
targetList = { _id: newListId, ...newListData }; targetList = { _id: newListId, ...newListData };
createdLists++; createdLists++;
@ -167,7 +170,7 @@ class FixMissingListsMigration {
// Update all cards in this group to use the correct listId // Update all cards in this group to use the correct listId
for (const card of cardsInList) { for (const card of cardsInList) {
ReactiveCache.getCollection('cards').update(card._id, { Cards.update(card._id, {
$set: { $set: {
listId: targetList._id, listId: targetList._id,
modifiedAt: new Date() modifiedAt: new Date()
@ -179,7 +182,7 @@ class FixMissingListsMigration {
} }
// Mark board as processed // Mark board as processed
ReactiveCache.getCollection('boards').update(boardId, { Boards.update(boardId, {
$set: { $set: {
fixMissingListsCompleted: true, fixMissingListsCompleted: true,
fixMissingListsCompletedAt: new Date() fixMissingListsCompletedAt: new Date()