Преглед на файлове

Add searching of checklists

John R. Supplee преди 4 години
родител
ревизия
5b51a36c62
променени са 1 файла, в които са добавени 8 реда и са изтрити 1 реда
  1. 8 1
      server/publications/cards.js

+ 8 - 1
server/publications/cards.js

@@ -507,7 +507,13 @@ Meteor.publish('globalSearch', function(sessionId, queryParams) {
 
     if (queryParams.text) {
       const regex = new RegExp(escapeForRegex(queryParams.text), 'i');
-
+      const items = ChecklistItems.find({ title: regex });
+      const checklists = Checklists.find({
+        $or: [
+          { title: regex },
+          { _id: { $in: items.map(item => item.checklistId) } },
+        ],
+      });
       selector.$and.push({
         $or: [
           { title: regex },
@@ -520,6 +526,7 @@ Meteor.publish('globalSearch', function(sessionId, queryParams) {
               ),
             },
           },
+          { _id: { $in: checklists.map(list => list.cardId) } },
         ],
       });
     }