Jelajahi Sumber

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

Martin Filser 2 tahun lalu
induk
melakukan
a533605608

+ 8 - 4
server/publications/boards.js

@@ -32,7 +32,7 @@ Meteor.publishRelations('boards', function() {
   // if(teamIdsUserBelongs && teamIdsUserBelongs != ''){
   // if(teamIdsUserBelongs && teamIdsUserBelongs != ''){
   //   teamsIds = teamIdsUserBelongs.split(',');
   //   teamsIds = teamIdsUserBelongs.split(',');
   // }
   // }
-  this.cursor(Boards.find(
+  this.cursor(ReactiveCache.getBoards(
     {
     {
       archived: false,
       archived: false,
       _id: { $in: Boards.userBoardIds(userId, false) },
       _id: { $in: Boards.userBoardIds(userId, false) },
@@ -49,6 +49,7 @@ Meteor.publishRelations('boards', function() {
     {
     {
       sort: { sort: 1 /* boards default sorting */ },
       sort: { sort: 1 /* boards default sorting */ },
     },
     },
+    true,
   ),
   ),
     function(boardId, board) {
     function(boardId, board) {
       this.cursor(
       this.cursor(
@@ -87,7 +88,7 @@ Meteor.publish('boardsReport', function() {
   // array to tell the client to remove the previously published docs.
   // array to tell the client to remove the previously published docs.
   if (!Match.test(userId, String) || !userId) return [];
   if (!Match.test(userId, String) || !userId) return [];
 
 
-  const boards = Boards.find(
+  const boards = ReactiveCache.getBoards(
     {
     {
       _id: { $in: Boards.userBoardIds(userId, null) },
       _id: { $in: Boards.userBoardIds(userId, null) },
     },
     },
@@ -110,6 +111,7 @@ Meteor.publish('boardsReport', function() {
       },
       },
       sort: { sort: 1 /* boards default sorting */ },
       sort: { sort: 1 /* boards default sorting */ },
     },
     },
+    true,
   );
   );
 
 
   const userIds = [];
   const userIds = [];
@@ -146,7 +148,7 @@ Meteor.publish('archivedBoards', function() {
   const userId = this.userId;
   const userId = this.userId;
   if (!Match.test(userId, String)) return [];
   if (!Match.test(userId, String)) return [];
 
 
-  const ret = Boards.find(
+  const ret = ReactiveCache.getBoards(
     {
     {
       _id: { $in: Boards.userBoardIds(userId, true)},
       _id: { $in: Boards.userBoardIds(userId, true)},
       archived: true,
       archived: true,
@@ -169,6 +171,7 @@ Meteor.publish('archivedBoards', function() {
       },
       },
       sort: { archivedAt: -1, modifiedAt: -1 },
       sort: { archivedAt: -1, modifiedAt: -1 },
     },
     },
+    true,
   );
   );
   return ret;
   return ret;
 });
 });
@@ -200,7 +203,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
   }
   }
 
 
   this.cursor(
   this.cursor(
-    Boards.find(
+    ReactiveCache.getBoards(
       {
       {
         _id: boardId,
         _id: boardId,
         archived: false,
         archived: false,
@@ -210,6 +213,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
         // Sort required to ensure oplog usage
         // Sort required to ensure oplog usage
       },
       },
       { limit: 1, sort: { sort: 1 /* boards default sorting */ } },
       { limit: 1, sort: { sort: 1 /* boards default sorting */ } },
+      true,
     ),
     ),
     function(boardId, board) {
     function(boardId, board) {
       this.cursor(Lists.find({ boardId, archived: isArchived }));
       this.cursor(Lists.find({ boardId, archived: isArchived }));

+ 3 - 2
server/publications/cards.js

@@ -68,7 +68,7 @@ Meteor.publishRelations('popupCardData', function(cardId) {
   this.cursor(
   this.cursor(
     Cards.find({_id: cardId}),
     Cards.find({_id: cardId}),
     function(cardId, card) {
     function(cardId, card) {
-      this.cursor(Boards.find({_id: card.boardId}));
+      this.cursor(ReactiveCache.getBoards({_id: card.boardId}, {}, true));
       this.cursor(Lists.find({boardId: card.boardId}));
       this.cursor(Lists.find({boardId: card.boardId}));
     },
     },
   );
   );
@@ -770,9 +770,10 @@ function findCards(sessionId, query) {
 
 
     return [
     return [
       cards,
       cards,
-      Boards.find(
+      ReactiveCache.getBoards(
         { _id: { $in: boards } },
         { _id: { $in: boards } },
         { fields: { ...fields, labels: 1, color: 1 } },
         { fields: { ...fields, labels: 1, color: 1 } },
+        true,
       ),
       ),
       Swimlanes.find(
       Swimlanes.find(
         { _id: { $in: swimlanes } },
         { _id: { $in: swimlanes } },

+ 1 - 1
server/publications/rules.js

@@ -42,7 +42,7 @@ Meteor.publish('rulesReport', () => {
     rules,
     rules,
     Actions.find({ _id: { $in: actionIds } }),
     Actions.find({ _id: { $in: actionIds } }),
     Triggers.find({ _id: { $in: triggerIds } }),
     Triggers.find({ _id: { $in: triggerIds } }),
-    Boards.find({ _id: { $in: boardIds } }, { fields: { title: 1 } }),
+    ReactiveCache.getBoards({ _id: { $in: boardIds } }, { fields: { title: 1 } }, true),
   ];
   ];
   return ret;
   return ret;
 });
 });