summaryrefslogtreecommitdiffstats
path: root/models/boards.js
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2018-04-16 16:48:54 -0300
committerAndrés Manelli <andresmanelli@gmail.com>2018-08-10 23:57:35 +0200
commita93de07fb9b85f97da274bf549e5244ee8e30484 (patch)
treefca34bc0c1f3a76a52115aebc467ec725e511ac7 /models/boards.js
parent64367a01dd6b86982c22b4c124e8f37474e9cb08 (diff)
downloadwekan-a93de07fb9b85f97da274bf549e5244ee8e30484.tar.gz
wekan-a93de07fb9b85f97da274bf549e5244ee8e30484.tar.bz2
wekan-a93de07fb9b85f97da274bf549e5244ee8e30484.zip
Avoid importing imported cards or boards
Diffstat (limited to 'models/boards.js')
-rw-r--r--models/boards.js12
1 files changed, 6 insertions, 6 deletions
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);