Move every CardComments.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory models/)

This commit is contained in:
Martin Filser 2023-02-25 20:10:31 +01:00
parent fef6433b75
commit 25989b9736
6 changed files with 11 additions and 11 deletions

View file

@ -129,11 +129,11 @@ template(name="minicard")
.badges
unless currentUser.isNoComments
if comments.count
.badge(title="{{_ 'card-comments-title' comments.count }}")
if comments.length
.badge(title="{{_ 'card-comments-title' comments.length }}")
span.badge-icon.fa.fa-comment-o.badge-comment
= ' '
= comments.count
= comments.length
//span.badge-comment.badge-text
//| {{_ 'comment'}}
if getDescription

View file

@ -172,7 +172,7 @@ CardComments.textSearch = (userId, textArray) => {
// eslint-disable-next-line no-console
// console.log('cardComments selector:', selector);
const comments = CardComments.find(selector);
const comments = ReactiveCache.getCardComments(selector);
// eslint-disable-next-line no-console
// console.log('count:', comments.count());
// eslint-disable-next-line no-console
@ -246,7 +246,7 @@ if (Meteor.isServer) {
Authentication.checkBoardAccess(req.userId, paramBoardId);
JsonRoutes.sendResult(res, {
code: 200,
data: CardComments.find({
data: ReactiveCache.getCardComments({
boardId: paramBoardId,
cardId: paramCardId,
}).map(function (doc) {

View file

@ -606,7 +606,7 @@ Cards.helpers({
});
// copy card comments
CardComments.find({ cardId: oldId }).forEach(cmt => {
ReactiveCache.getCardComments({ cardId: oldId }).forEach(cmt => {
cmt.copy(_id);
});
// restore the id, otherwise new copies will fail
@ -780,12 +780,12 @@ Cards.helpers({
comments() {
let ret
if (this.isLinkedBoard()) {
ret = CardComments.find(
ret = ReactiveCache.getCardComments(
{ boardId: this.linkedId },
{ sort: { createdAt: -1 } },
);
} else {
ret = CardComments.find(
ret = ReactiveCache.getCardComments(
{ cardId: this.getRealId() },
{ sort: { createdAt: -1 } },
);

View file

@ -104,7 +104,7 @@ export class Exporter {
{ boardIds: this._boardId },
{ fields: { boardIds: 0 } },
);
result.comments = CardComments.find(byBoard, noBoardId).fetch();
result.comments = ReactiveCache.getCardComments(byBoard, noBoardId);
result.activities = ReactiveCache.getActivities(byBoard, noBoardId);
result.rules = ReactiveCache.getRules(byBoard, noBoardId);
result.checklists = [];

View file

@ -55,7 +55,7 @@ class ExporterCardPDF {
},
},
);
result.comments = CardComments.find(byBoard, noBoardId).fetch();
result.comments = ReactiveCache.getCardComments(byBoard, noBoardId);
result.activities = ReactiveCache.getActivities(byBoard, noBoardId);
result.rules = ReactiveCache.getRules(byBoard, noBoardId);
result.checklists = [];

View file

@ -57,7 +57,7 @@ class ExporterExcel {
},
},
);
result.comments = CardComments.find(byBoard, noBoardId).fetch();
result.comments = ReactiveCache.getCardComments(byBoard, noBoardId);
result.activities = ReactiveCache.getActivities(byBoard, noBoardId);
result.rules = ReactiveCache.getRules(byBoard, noBoardId);
result.checklists = [];