Explorar el Código

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

Martin Filser hace 2 años
padre
commit
25989b9736

+ 3 - 3
client/components/cards/minicard.jade

@@ -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

+ 2 - 2
models/cardComments.js

@@ -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) {

+ 3 - 3
models/cards.js

@@ -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 } },
       );

+ 1 - 1
models/exporter.js

@@ -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 = [];

+ 1 - 1
models/server/ExporterCardPDF.js

@@ -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 = [];

+ 1 - 1
models/server/ExporterExcel.js

@@ -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 = [];