summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
authorIgnatzHome <ignatz@maschath.de>2018-05-20 09:33:51 +0200
committerIgnatzHome <ignatz@maschath.de>2018-05-20 09:33:51 +0200
commit39974c953247190fe373a583830d1ec3bc6899f7 (patch)
treea57292e984b52a46fbf8a53ec19809c61ef92806 /client/lib
parent4ff8989e8fe6aab9f67f0471d0986823293ddc9d (diff)
downloadwekan-39974c953247190fe373a583830d1ec3bc6899f7.tar.gz
wekan-39974c953247190fe373a583830d1ec3bc6899f7.tar.bz2
wekan-39974c953247190fe373a583830d1ec3bc6899f7.zip
rewrite Filter._getMongoSelecto to not include Empty Filter.
Diffstat (limited to 'client/lib')
-rw-r--r--client/lib/filter.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/client/lib/filter.js b/client/lib/filter.js
index 9f42068b..790e4f49 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -248,18 +248,16 @@ Filter = {
const exceptionsSelector = {_id: {$in: this._exceptions}};
this._exceptionsDep.depend();
- console.log("Final Filter:");
- console.log({
- $or: [filterSelector, exceptionsSelector, this.advanced._getMongoSelector()],
- });
- if (includeEmptySelectors)
- return {
- $or: [filterSelector, exceptionsSelector, this.advanced._getMongoSelector(), emptySelector],
- };
- else
- return {
- $or: [filterSelector, exceptionsSelector, this.advanced._getMongoSelector()],
- };
+
+ const selectors = [exceptionsSelector];
+
+ if (_.any(this._fields, (fieldName) => {
+ return this[fieldName]._isActive();
+ })) selectors.push(filterSelector);
+ if (includeEmptySelectors) selectors.push(emptySelector);
+ if (this.advanced._isActive()) selectors.push(this.advanced._getMongoSelector());
+
+ return {$or: selectors};
},
mongoSelector(additionalSelector) {