Bläddra i källkod

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

Martin Filser 2 år sedan
förälder
incheckning
ea72ce1fa2
2 ändrade filer med 3 tillägg och 3 borttagningar
  1. 2 2
      models/activities.js
  2. 1 1
      models/integrations.js

+ 2 - 2
models/activities.js

@@ -334,12 +334,12 @@ if (Meteor.isServer) {
       }
       }
     });
     });
 
 
-    const integrations = Integrations.find({
+    const integrations = ReactiveCache.getIntegrations({
       boardId: { $in: [board._id, Integrations.Const.GLOBAL_WEBHOOK_ID] },
       boardId: { $in: [board._id, Integrations.Const.GLOBAL_WEBHOOK_ID] },
       // type: 'outgoing-webhooks', // all types
       // type: 'outgoing-webhooks', // all types
       enabled: true,
       enabled: true,
       activities: { $in: [description, 'all'] },
       activities: { $in: [description, 'all'] },
-    }).fetch();
+    });
     if (integrations.length > 0) {
     if (integrations.length > 0) {
       params.watchers = watchers;
       params.watchers = watchers;
       integrations.forEach(integration => {
       integrations.forEach(integration => {

+ 1 - 1
models/integrations.js

@@ -142,7 +142,7 @@ if (Meteor.isServer) {
       const paramBoardId = req.params.boardId;
       const paramBoardId = req.params.boardId;
       Authentication.checkBoardAccess(req.userId, paramBoardId);
       Authentication.checkBoardAccess(req.userId, paramBoardId);
 
 
-      const data = Integrations.find(
+      const data = ReactiveCache.getIntegrations(
         { boardId: paramBoardId },
         { boardId: paramBoardId },
         { fields: { token: 0 } },
         { fields: { token: 0 } },
       ).map(function(doc) {
       ).map(function(doc) {