From a93de07fb9b85f97da274bf549e5244ee8e30484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Mon, 16 Apr 2018 16:48:54 -0300 Subject: Avoid importing imported cards or boards --- client/components/lists/listBody.js | 3 ++- models/boards.js | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 2c8b1af7..c0533008 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -337,6 +337,7 @@ BlazeComponent.extendComponent({ swimlaneId: this.selectedSwimlaneId.get(), listId: this.selectedListId.get(), archived: false, + importedId: null, }); }, @@ -436,7 +437,7 @@ BlazeComponent.extendComponent({ results() { const board = Boards.findOne(this.selectedBoardId.get()); - return board.searchCards(this.term.get()); + return board.searchCards(this.term.get(), true); }, events() { diff --git a/models/boards.js b/models/boards.js index eda34bf4..d5ccc954 100644 --- a/models/boards.js +++ b/models/boards.js @@ -298,22 +298,22 @@ Boards.helpers({ return _id; }, - searchCards(term) { + searchCards(term, excludeImported) { check(term, Match.OneOf(String, null, undefined)); let query = { boardId: this._id }; + if (excludeImported) { + query.importedId = null; + } const projection = { limit: 10, sort: { createdAt: -1 } }; if (term) { const regex = new RegExp(term, 'i'); - query = { - boardId: this._id, - $or: [ + query.$or = [ { title: regex }, { description: regex }, - ], - }; + ]; } return Cards.find(query, projection); -- cgit v1.2.3-1-g7c22