浏览代码

Avoid importing imported cards or boards

Andrés Manelli 7 年之前
父节点
当前提交
a93de07fb9
共有 2 个文件被更改,包括 8 次插入7 次删除
  1. 2 1
      client/components/lists/listBody.js
  2. 6 6
      models/boards.js

+ 2 - 1
client/components/lists/listBody.js

@@ -337,6 +337,7 @@ BlazeComponent.extendComponent({
       swimlaneId: this.selectedSwimlaneId.get(),
       swimlaneId: this.selectedSwimlaneId.get(),
       listId: this.selectedListId.get(),
       listId: this.selectedListId.get(),
       archived: false,
       archived: false,
+      importedId: null,
     });
     });
   },
   },
 
 
@@ -436,7 +437,7 @@ BlazeComponent.extendComponent({
 
 
   results() {
   results() {
     const board = Boards.findOne(this.selectedBoardId.get());
     const board = Boards.findOne(this.selectedBoardId.get());
-    return board.searchCards(this.term.get());
+    return board.searchCards(this.term.get(), true);
   },
   },
 
 
   events() {
   events() {

+ 6 - 6
models/boards.js

@@ -298,22 +298,22 @@ Boards.helpers({
     return _id;
     return _id;
   },
   },
 
 
-  searchCards(term) {
+  searchCards(term, excludeImported) {
     check(term, Match.OneOf(String, null, undefined));
     check(term, Match.OneOf(String, null, undefined));
 
 
     let query = { boardId: this._id };
     let query = { boardId: this._id };
+    if (excludeImported) {
+      query.importedId = null;
+    }
     const projection = { limit: 10, sort: { createdAt: -1 } };
     const projection = { limit: 10, sort: { createdAt: -1 } };
 
 
     if (term) {
     if (term) {
       const regex = new RegExp(term, 'i');
       const regex = new RegExp(term, 'i');
 
 
-      query = {
-        boardId: this._id,
-        $or: [
+      query.$or = [
           { title: regex },
           { title: regex },
           { description: regex },
           { description: regex },
-        ],
-      };
+        ];
     }
     }
 
 
     return Cards.find(query, projection);
     return Cards.find(query, projection);