Skip to content

Commit

Permalink
Merge branch 'hotfix/18.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescdavis committed Dec 18, 2018
2 parents dedd31a + fbf9541 commit 4f01be7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [18.2.1] - 2018-12-06
## [18.2.2] - 2018-12-18
### Added:
- Flags:
- `enable_inactive_schemas`

### Changed:
- Components:
- regisitries:
- `registries-registration-type-facet` - only add ERPC schema when `enable_inactive_schemas` flag is off

## [18.2.1] - 2018-12-18
### Added
- Mirage:
- `queryParamIsTruthy` util
Expand Down
1 change: 1 addition & 0 deletions config/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ declare const config: {
institutions: string;
};
storageI18n: string;
enableInactiveSchemas: string;
};
gReCaptcha: {
siteKey: string;
Expand Down
1 change: 1 addition & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ module.exports = function(environment) {
institutions: 'institutions_nav_bar',
},
storageI18n: 'storage_i18n',
enableInactiveSchemas: 'enable_inactive_schemas',
},
gReCaptcha: {
siteKey: RECAPTCHA_SITE_KEY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,49 @@ import EmberArray, { A } from '@ember/array';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
import DS from 'ember-data';
import Features from 'ember-feature-flags/services/features';
import appConfig from 'ember-get-config';
import I18N from 'ember-i18n/services/i18n';
import Toast from 'ember-toastr/services/toast';

import RegistrationSchema from 'ember-osf-web/adapters/registration-schema';
import requiredAction from 'ember-osf-web/decorators/required-action';
import Analytics from 'ember-osf-web/services/analytics';
import defaultTo from 'ember-osf-web/utils/default-to';
import Toast from 'ember-toastr/services/toast';
import config from 'registries/config/environment';

import engineConfig from 'registries/config/environment';
import { SearchOptions } from 'registries/services/search';
import { ShareTermsFilter } from 'registries/services/share-search';
import layout from './template';

const {
sourcesWhitelist,
} = engineConfig;

const {
featureFlagNames: {
enableInactiveSchemas,
},
} = appConfig;

export default class RegistriesRegistrationTypeFacet extends Component.extend({
fetchRegistrationTypes: task(function *(this: RegistriesRegistrationTypeFacet): any {
try {
const metaschemas: RegistrationSchema[] = yield this.store.findAll('registration-schema');

this.set('registrationTypes', A(
metaschemas.mapBy('name').concat([
const metaschemaNames = metaschemas.mapBy('name');
if (!this.features.isEnabled(enableInactiveSchemas)) {
metaschemaNames.push(
// Manually add 'Election Research Preacceptance Competition' to the list of possible
// facets. Metaschema was removed from the API as a possible registration type
// but should still be searchable
'Election Research Preacceptance Competition',
]).sort(),
));
);
}
this.set('registrationTypes', A(metaschemaNames.sort()));
} catch (e) {
this.toast.error(this.i18n.t('registries.facets.registration_type.registration_schema_error'));
throw e;
}
}).on('init'),
}) {
Expand All @@ -39,6 +56,7 @@ export default class RegistriesRegistrationTypeFacet extends Component.extend({
@service toast!: Toast;
@service store!: DS.Store;
@service analytics!: Analytics;
@service features!: Features;

searchOptions!: SearchOptions;
@requiredAction onSearchOptionsUpdated!: (options: SearchOptions) => void;
Expand All @@ -53,7 +71,7 @@ export default class RegistriesRegistrationTypeFacet extends Component.extend({
get onlyOSF() {
return this.searchOptions.filters.filter(filter => filter.key === 'sources').size === 1
&& this.searchOptions.filters.contains(
new ShareTermsFilter('sources', 'OSF', config.sourcesWhitelist.find(x => x.name === 'OSF')!.display!),
new ShareTermsFilter('sources', 'OSF', sourcesWhitelist.find(x => x.name === 'OSF')!.display!),
);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-osf-web",
"version": "18.2.1",
"version": "18.2.2",
"description": "Ember front-end for the Open Science Framework",
"license": "Apache-2.0",
"author": "Center for Open Science <support@cos.io>",
Expand Down

0 comments on commit 4f01be7

Please sign in to comment.