summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
authorIgnatzHome <ignatz@maschath.de>2018-05-19 16:06:06 +0200
committerIgnatzHome <ignatz@maschath.de>2018-05-19 16:06:06 +0200
commitbc0aef3332ff220c7e3cba640bda69bd72567bfd (patch)
treed6071b343d5953427a239961ecafd0c0f9bfc41c /client/lib
parentf6d19d2833b322eb54762dae7a8d51d07718ef24 (diff)
downloadwekan-bc0aef3332ff220c7e3cba640bda69bd72567bfd.tar.gz
wekan-bc0aef3332ff220c7e3cba640bda69bd72567bfd.tar.bz2
wekan-bc0aef3332ff220c7e3cba640bda69bd72567bfd.zip
More Filter Corrections (Custom Fields)
Diffstat (limited to 'client/lib')
-rw-r--r--client/lib/filter.js19
1 files changed, 3 insertions, 16 deletions
diff --git a/client/lib/filter.js b/client/lib/filter.js
index ecc95d40..80793db2 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -11,7 +11,7 @@ function showFilterSidebar() {
// Use a "set" filter for a field that is a set of documents uniquely
// identified. For instance `{ labels: ['labelA', 'labelC', 'labelD'] }`.
// use "subField" for searching inside object Fields.
-// For instance '{ customFields: [{_id : { $in: ['field1']}}]} (subField would be: _id)
+// For instance '{ 'customFields._id': ['field1','field2']} (subField would be: _id)
class SetFilter {
constructor(subField = '') {
this._dep = new Tracker.Dependency();
@@ -64,21 +64,7 @@ class SetFilter {
_getMongoSelector() {
this._dep.depend();
- if (this.subField !== '')
- {
-
- const selector = [];
- this._selectedElements.forEach((element) => {
- const item = [];
- item[this.subField] = {$in: [element]};
- selector.push(item);
- });
- return {$in: selector};
- }
- else
- {
- return { $in: this._selectedElements };
- }
+ return { $in: this._selectedElements };
}
_getEmptySelector() {
@@ -128,6 +114,7 @@ Filter = {
let includeEmptySelectors = false;
this._fields.forEach((fieldName) => {
const filter = this[fieldName];
+ if (filter.subField !== '') fieldName = `${fieldName}.${filter.subField}`;
if (filter._isActive()) {
filterSelector[fieldName] = filter._getMongoSelector();
emptySelector[fieldName] = filter._getEmptySelector();