浏览代码

Move every Checklists.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory server/)

Martin Filser 2 年之前
父节点
当前提交
a4408b55ed
共有 2 个文件被更改,包括 11 次插入7 次删除
  1. 1 1
      server/publications/cards.js
  2. 10 6
      server/publications/notifications.js

+ 1 - 1
server/publications/cards.js

@@ -791,7 +791,7 @@ function findCards(sessionId, query) {
       ReactiveCache.getLists({ _id: { $in: lists } }, { fields }, true),
       ReactiveCache.getCustomFields({ _id: { $in: customFieldIds } }, {}, true),
       ReactiveCache.getUsers({ _id: { $in: users } }, { fields: Users.safeFields }, true),
-      Checklists.find({ cardId: { $in: cards.map(c => c._id) } }),
+      ReactiveCache.getChecklists({ cardId: { $in: cards.map(c => c._id) } }, {}, true),
       ReactiveCache.getChecklistItems({ cardId: { $in: cards.map(c => c._id) } }, {}, true),
       Attachments.find({ 'meta.cardId': { $in: cards.map(c => c._id) } }).cursor,
       CardComments.find({ cardId: { $in: cards.map(c => c._id) } }),

+ 10 - 6
server/publications/notifications.js

@@ -54,13 +54,17 @@ Meteor.publish('notificationChecklistItems', function() {
 
 // gets all checklists associated with activities associated with the current user
 Meteor.publish('notificationChecklists', function() {
-  const ret = Checklists.find({
-    _id: {
-      $in: activities()
-        .map(v => v.checklistId)
-        .filter(v => !!v),
+  const ret = ReactiveCache.getChecklists(
+    {
+      _id: {
+        $in: activities()
+          .map(v => v.checklistId)
+          .filter(v => !!v),
+      },
     },
-  });
+    {},
+    true,
+  );
   return ret;
 });