diff --git a/models/cards.js b/models/cards.js index 39fcc7f92..a034311f1 100644 --- a/models/cards.js +++ b/models/cards.js @@ -8,7 +8,6 @@ import { } from '../config/const'; import Attachments, { fileStoreStrategyFactory } from "./attachments"; import { copyFile } from './lib/fileStoreStrategy.js'; -import { DataCache } from 'meteor-reactive-cache'; Cards = new Mongo.Collection('cards'); @@ -595,7 +594,7 @@ Cards.helpers({ }); // copy checklists - Checklists.find({ cardId: oldId }).forEach(ch => { + ReactiveCache.getChecklists({ cardId: oldId }).forEach(ch => { ch.copy(_id); }); @@ -811,10 +810,8 @@ Cards.helpers({ }, checklists() { - if (!this._checklists) { - this._checklists = new DataCache(() => Checklists.find({ cardId: this.getRealId() }, { sort: { sort: 1 } }).fetch(), 1000); - } - return this._checklists.get(); + const ret = ReactiveCache.getChecklists({ cardId: this.getRealId() }, { sort: { sort: 1 } }); + return ret; }, firstChecklist() { diff --git a/models/checklists.js b/models/checklists.js index 33ab670a8..cc372e257 100644 --- a/models/checklists.js +++ b/models/checklists.js @@ -256,7 +256,7 @@ if (Meteor.isServer) { const paramBoardId = req.params.boardId; const paramCardId = req.params.cardId; Authentication.checkBoardAccess(req.userId, paramBoardId); - const checklists = Checklists.find({ cardId: paramCardId }).map(function( + const checklists = ReactiveCache.getChecklists({ cardId: paramCardId }).map(function( doc, ) { return { diff --git a/models/exporter.js b/models/exporter.js index b091c7d2b..5b4fcaee3 100644 --- a/models/exporter.js +++ b/models/exporter.js @@ -114,9 +114,9 @@ export class Exporter { result.actions = []; result.cards.forEach((card) => { result.checklists.push( - ...Checklists.find({ + ...ReactiveCache.getChecklists({ cardId: card._id, - }).fetch(), + }), ); result.checklistItems.push( ...ReactiveCache.getChecklistItems({ diff --git a/models/server/ExporterCardPDF.js b/models/server/ExporterCardPDF.js index c1f39391a..7fbec6d0d 100644 --- a/models/server/ExporterCardPDF.js +++ b/models/server/ExporterCardPDF.js @@ -65,9 +65,9 @@ class ExporterCardPDF { result.actions = []; result.cards.forEach((card) => { result.checklists.push( - ...Checklists.find({ + ...ReactiveCache.getChecklists({ cardId: card._id, - }).fetch(), + }), ); result.checklistItems.push( ...ReactiveCache.getChecklistItems({ diff --git a/models/server/ExporterExcel.js b/models/server/ExporterExcel.js index 64f00352a..0e4f60746 100644 --- a/models/server/ExporterExcel.js +++ b/models/server/ExporterExcel.js @@ -67,9 +67,9 @@ class ExporterExcel { result.actions = []; result.cards.forEach((card) => { result.checklists.push( - ...Checklists.find({ + ...ReactiveCache.getChecklists({ cardId: card._id, - }).fetch(), + }), ); result.checklistItems.push( ...ReactiveCache.getChecklistItems({