Skip to content

Commit dedd31a

Browse files
committed
Merge branch 'hotfix/18.2.1'
2 parents 86e7343 + a4f692c commit dedd31a

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [18.2.1] - 2018-12-06
8+
### Added
9+
- Mirage:
10+
- `queryParamIsTruthy` util
11+
12+
### Changed
13+
- Routes:
14+
- `guid-node.registrations` - add `?filter[active]=true` when fetching registration schemas
15+
- Mirage:
16+
- use `queryParamIsTruthy` helper for boolean comparison
17+
718
## [18.2.0] - 2018-11-29
819
### Changed
920
- Components:

app/guid-node/registrations/controller.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ export default class GuidNodeRegistrations extends Controller {
3939
};
4040

4141
getRegistrationSchemas = task(function *(this: GuidNodeRegistrations) {
42-
let schemas = yield this.store.findAll('registration-schema');
42+
let schemas = yield this.store.findAll('registration-schema',
43+
{
44+
adapterOptions: {
45+
query: {
46+
'filter[active]': true,
47+
},
48+
},
49+
});
4350
schemas = schemas.toArray();
4451
schemas.sort((a: RegistrationSchema, b: RegistrationSchema) => {
4552
return a.name.length - b.name.length;

mirage/views/private/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { camelize } from '@ember/string';
22
import { HandlerContext, Request, Schema } from 'ember-cli-mirage';
33
import { Resource, ResourceCollectionDocument } from 'osf-api';
44

5+
import { queryParamIsTruthy } from '../utils';
6+
57
export enum ComparisonOperators {
68
Eq = 'eq',
79
Ne = 'ne',
@@ -227,7 +229,7 @@ export function compare(actualValue: any, comparisonValue: any, operator: Compar
227229
if (typeof actualValue === 'string') {
228230
return compareStrings(actualValue, comparisonValue, operator);
229231
} else if (typeof actualValue === 'boolean') {
230-
return compareBooleans(actualValue, comparisonValue, operator);
232+
return compareBooleans(actualValue, queryParamIsTruthy(comparisonValue), operator);
231233
} else {
232234
throw new Error(`We haven't implemented comparisons with "${operator}" yet.`);
233235
}

mirage/views/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ export function filter(model: any, request: any) {
3737
}
3838
});
3939
}
40+
41+
export function queryParamIsTruthy(value?: string) {
42+
return Boolean(
43+
value && ['true', '1'].includes(value.toString().toLowerCase()),
44+
);
45+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-osf-web",
3-
"version": "18.2.0",
3+
"version": "18.2.1",
44
"description": "Ember front-end for the Open Science Framework",
55
"license": "Apache-2.0",
66
"author": "Center for Open Science <[email protected]>",

0 commit comments

Comments
 (0)