Skip to content

Commit 41fa9a7

Browse files
VincentMoliniearnaudbesnier
authored andcommitted
[*] Record List - Fix record listing on table which reference table with id not string (#272)
1 parent b2dcb76 commit 41fa9a7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
### Fixed
1313
- Technical - Exclude from pre-commit-hook linter files that are not committed.
1414
- Security - Patch vulnerabilities upgrading the `mixin-deep` dependency.
15+
- Record List - Fix record listing on table which reference table with id not string.
1516

1617
## RELEASE 5.4.1 - 2019-12-11
1718
### Changed

src/services/filters-parser.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ function FiltersParser(model, timezone, options) {
2222
if (ObjectId.isValid(value) && ObjectId(value).toString() === value) {
2323
return ObjectId(value);
2424
}
25-
if (_.isArray(value)) {
26-
return value
27-
.map((arrayValue) => (ObjectId.isValid(arrayValue) ? ObjectId(arrayValue) : arrayValue));
28-
}
2925
return value;
3026
};
3127
const parseArray = (value) => ({ $size: value });
@@ -98,7 +94,14 @@ function FiltersParser(model, timezone, options) {
9894

9995
if (!field) return (val) => val;
10096

101-
return this.getParserForType(field.type);
97+
const parse = this.getParserForType(field.type);
98+
99+
return (value) => {
100+
if (value && _.isArray(value)) {
101+
return value.map(parse);
102+
}
103+
return parse(value);
104+
};
102105
};
103106

104107
this.formatAggregatorOperator = (aggregatorOperator) => {

0 commit comments

Comments
 (0)