Skip to content

Commit

Permalink
Merge branch 'release/21.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabmiz committed May 27, 2021
2 parents c68590d + e30d287 commit 77b1022
Show file tree
Hide file tree
Showing 25 changed files with 581 additions and 33 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ 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).

## [21.5.0] - 2021-05-27
### Fixed
- registration Detail Page: longer license types spill out of bounds
- unencode special characters in Registries Moderator Comments and Registries Custom Metadata
- (deprecations) use jQuery in lieu of Ember.$()
- (deprecations) use ember-copy in lieu of copy method and Copyable mixin

### Changed
- (project-based registration) ensure only templates associated with OSF Registries is shown

### Added
- (my-registrations page) text explaining how submitted/draft registrations are sorted

## [21.4.1] - 2021-05-26
### Changed
- hide registration state for anonymous VOLs
Expand Down Expand Up @@ -1728,7 +1741,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Quick Files

[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/21.4.1...develop
[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/21.5.0...develop
[21.5.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/21.5.0
[21.4.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/21.4.1
[21.4.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/21.4.0
[21.3.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/21.3.0
Expand Down
3 changes: 2 additions & 1 deletion app/dashboard/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import User from 'ember-osf-web/models/user';
import Analytics from 'ember-osf-web/services/analytics';
import CurrentUser from 'ember-osf-web/services/current-user';

import $ from 'jquery';

// TODO pull these from the database
const {
dashboard: {
Expand Down Expand Up @@ -80,7 +82,6 @@ export default class Dashboard extends Controller {

const nodes: QueryHasManyResult<Node> = yield user.queryHasMany('sparseNodes', {
embed: ['bibliographic_contributors', 'parent', 'root'],
// eslint-disable-next-line ember/no-global-jquery
filter: this.filter ? { title: $('<div>').text(this.filter).html() } : undefined,
page: more ? this.incrementProperty('page') : this.set('page', 1),
sort: this.sort || undefined,
Expand Down
13 changes: 8 additions & 5 deletions app/guid-node/registrations/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency-decorators';
import DS from 'ember-data';
import config from 'ember-get-config';

import Node from 'ember-osf-web/models/node';
import RegistrationProviderModel from 'ember-osf-web/models/registration-provider';
import RegistrationSchema from 'ember-osf-web/models/registration-schema';
import Analytics from 'ember-osf-web/services/analytics';

Expand Down Expand Up @@ -37,11 +39,12 @@ export default class GuidNodeRegistrations extends Controller {

@task({ withTestWaiter: true })
getRegistrationSchemas = task(function *(this: GuidNodeRegistrations) {
let schemas = yield this.store.query('registration-schema',
{
'filter[active]': true,
'page[size]': 100,
});
const { defaultProvider } = config;
const provider: RegistrationProviderModel = yield this.store.findRecord(
'registration-provider',
defaultProvider,
);
let schemas: RegistrationSchema[] = yield provider.loadAll('schemas');
schemas = schemas.toArray();
schemas.sort((a: RegistrationSchema, b: RegistrationSchema) => a.name.length - b.name.length);
this.set('defaultSchema', schemas.firstObject);
Expand Down
2 changes: 1 addition & 1 deletion app/models/review-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class ReviewActionModel extends OsfModel {
@service intl!: Intl;

@attr('string') actionTrigger!: ReviewActionTrigger;
@attr('string') comment!: string;
@attr('fixstring') comment!: string;
@attr('string') fromState!: string;
@attr('string') toState!: string;
@attr('date') dateCreated!: Date;
Expand Down
2 changes: 2 additions & 0 deletions app/services/current-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import RSVP from 'rsvp';
import User from 'ember-osf-web/models/user';
import { addQueryParam } from 'ember-osf-web/utils/url-parts';

import $ from 'jquery';

const {
OSF: {
url: osfUrl,
Expand Down
1 change: 1 addition & 0 deletions config/optional-features.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"jquery-integration": true,
"template-only-glimmer-components": true
}
8 changes: 8 additions & 0 deletions lib/app-components/addon/helpers/fix-string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Helper from '@ember/component/helper';
import fixSpecialChars from 'ember-osf-web/utils/fix-special-char';

export default class FixString extends Helper {
compute([textToFix]: [string]): string {
return fixSpecialChars(textToFix);
}
}
1 change: 1 addition & 0 deletions lib/app-components/app/helpers/fix-string.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'app-components/helpers/fix-string';
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import File from 'ember-osf-web/models/file';
import Analytics from 'ember-osf-web/services/analytics';
import pathJoin from 'ember-osf-web/utils/path-join';

import $ from 'jquery';

import styles from './styles';
import template from './template';

Expand Down Expand Up @@ -130,7 +132,7 @@ export default class FileShareButton extends Component {
function renderMfr() {
var mfrRender = new mfr.Render("mfrIframe", "${this.mfrUrl}");
}
if (window.jQuery) {
if (window.$) {
renderMfr();
} else {
var jq = document.createElement('script');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
data-test-registration-provider-metadata-field-value={{@field.field_name}}
local-class='ProviderMetadataValue'
>
{{@field.field_value}}
{{fix-string @field.field_value}}
</span>
</div>
5 changes: 5 additions & 0 deletions lib/registries/addon/components/license-viewer/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
padding: 0;
border: 0;
}

.LicenseName {
white-space: normal;
text-align: left;
}
6 changes: 5 additions & 1 deletion lib/registries/addon/components/license-viewer/template.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<OsfDialog as |dialog|>

<dialog.trigger>
<OsfButton
data-analytics-name='View license'
local-class='LinkButton'
@type='link'
@onClick={{dialog.open}}
>
{{@registration.license.name}}
<div local-class='LicenseName'>
{{@registration.license.name}}
</div>
</OsfButton>
</dialog.trigger>

Expand All @@ -27,4 +30,5 @@
{{/if}}
<LicenseText @node={{@registration}} />
</dialog.main>

</OsfDialog>
6 changes: 6 additions & 0 deletions lib/registries/addon/my-registrations/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@
}
}
}

.SortDescription {
text-align: right;
margin-top: 10px;
margin-right: 15px;
}
3 changes: 3 additions & 0 deletions lib/registries/addon/my-registrations/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
@activeId={{this.tab}}
as |tab|
>
<div local-class='SortDescription'>
{{t 'registries.my_registrations.sorted'}}
</div>
<tab.pane
local-class='Tab'
@title={{t 'registries.my_registrations.drafts'}}
Expand Down
7 changes: 7 additions & 0 deletions mirage/factories/registration-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface MirageRegistrationProvider extends RegistrationProvider {

export interface RegistrationProviderTraits {
withBrand: Trait;
withAllSchemas: Trait;
withSchemas: Trait;
submissionsNotAllowed: Trait;
withModerators: Trait;
Expand Down Expand Up @@ -66,6 +67,12 @@ export default Factory.extend<MirageRegistrationProvider & RegistrationProviderT
provider.update({ schemas: [server.schema.registrationSchemas.find('testSchema')] });
},
}),
withAllSchemas: trait<RegistrationProvider>({
afterCreate(provider, server) {
const schemas = server.schema.registrationSchemas.all().models;
provider.update({ schemas });
},
}),
submissionsNotAllowed: trait<RegistrationProvider>({
afterCreate(provider) {
provider.update({ allowSubmissions: false });
Expand Down
26 changes: 26 additions & 0 deletions mirage/fixtures/registration-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,30 @@ const testSchema = {
},
};

const testSchemaTwo = {
id: 'testSchemaTwo',
active: true,
name: 'This is a second Test Schema',
schemaVersion: 801,
schemaBlockIds: ids,
schemaNoConflict: {
title: 'Fake title for testing',
pages: [],
},
};

const testSchemaThree = {
id: 'testSchemaThree',
active: true,
name: 'This is a third Test Schema',
schemaVersion: 801,
schemaBlockIds: ids,
schemaNoConflict: {
title: 'Fake title for testing',
pages: [],
},
};

export default [
prereg_challenge,
open_ended_registration,
Expand All @@ -50,6 +74,8 @@ export default [
replication_recipe_pre_registration,
pre_registration_in_social_psychology,
testSchema,
testSchemaTwo,
testSchemaThree,
] as MirageRegistrationSchema[];

/* eslint-enable camelcase */
9 changes: 9 additions & 0 deletions mirage/scenarios/registrations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ModelInstance, Server } from 'ember-cli-mirage';
import config from 'ember-get-config';

import { StorageStatus } from 'ember-osf-web/models/node-storage';
import { Permission } from 'ember-osf-web/models/osf-model';
Expand Down Expand Up @@ -41,8 +42,15 @@ export function registrationScenario(
server: Server,
currentUser: ModelInstance<User>,
) {
const { defaultProvider } = config;
server.loadFixtures('citation-styles');

server.create('registration-provider', {
id: defaultProvider,
shareSource: 'OSF Registries',
name: 'OSF Registries',
}, 'withAllSchemas');

server.create('registration', { id: 'beefs' });

const currentUserWrite = server.create('registration', {
Expand All @@ -66,6 +74,7 @@ export function registrationScenario(
};

const rootNode = server.create('node', {
id: 'anode',
public: false,
contributors: server.createList('contributor', 10),
currentUserPermissions: [Permission.Admin],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-osf-web",
"version": "21.4.1",
"version": "21.5.0",
"description": "Ember front-end for the Open Science Framework",
"license": "Apache-2.0",
"author": "Center for Open Science <[email protected]>",
Expand Down Expand Up @@ -155,7 +155,7 @@
"ember-intl": "^4.2.2",
"ember-load-initializers": "^2.0.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-metrics": "https://github.com/cos-forks/ember-metrics#v0.12.1+cos0",
"ember-metrics": "https://github.com/cos-forks/ember-metrics#1.0.0+cos0",
"ember-mockdate-shim": "^0.1.0",
"ember-moment": "^7.7.0",
"ember-onbeforeunload": "^1.2.0",
Expand Down
31 changes: 28 additions & 3 deletions tests/acceptance/guid-node/registrations-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { click as untrackedClick, currentRouteName } from '@ember/test-helpers';
import { setupMirage } from 'ember-cli-mirage/test-support';
import config from 'ember-get-config';
import { percySnapshot } from 'ember-percy';
import { module, test } from 'qunit';

Expand All @@ -13,11 +14,18 @@ import { click, currentURL, setupOSFApplicationTest, visit } from 'ember-osf-web

import { Permission } from 'ember-osf-web/models/osf-model';

const { defaultProvider } = config;

module('Acceptance | guid-node/registrations', hooks => {
setupOSFApplicationTest(hooks);
setupMirage(hooks);

test('logged out, no registrations', async assert => {
server.create('registration-provider', {
id: defaultProvider,
shareSource: 'OSF Registries',
name: 'OSF Registries',
});
const node = server.create('node', { id: 'decaf', currentUserPermissions: [] });

const url = `/${node.id}/registrations`;
Expand Down Expand Up @@ -148,7 +156,11 @@ module('Acceptance | guid-node/registrations', hooks => {

test('logged in admin, no registrations', async assert => {
server.create('user', 'loggedIn');

server.create('registration-provider', {
id: defaultProvider,
shareSource: 'OSF Registries',
name: 'OSF Registries',
});
const node = server.create('node', { id: 'decaf' }, 'currentUserAdmin');

const url = `/${node.id}/registrations`;
Expand Down Expand Up @@ -177,7 +189,11 @@ module('Acceptance | guid-node/registrations', hooks => {

test('logged in admin, 1 registration', async assert => {
const contributorUser = server.create('user', 'loggedIn');

server.create('registration-provider', {
id: defaultProvider,
shareSource: 'OSF Registries',
name: 'OSF Registries',
});
const node = server.create('node', {
id: 'decaf',
title: 'Test Title',
Expand Down Expand Up @@ -362,6 +378,11 @@ module('Acceptance | guid-node/registrations', hooks => {

server.loadFixtures('schema-blocks');
server.loadFixtures('registration-schemas');
server.create('registration-provider', {
id: defaultProvider,
shareSource: 'OSF Registries',
name: 'OSF Registries',
}, 'withAllSchemas');

const url = `/${node.id}/registrations`;

Expand Down Expand Up @@ -391,11 +412,15 @@ module('Acceptance | guid-node/registrations', hooks => {

test('logged in admin, prereg challenge modal', async assert => {
server.create('user', 'loggedIn');

const node = server.create('node', { id: 'decaf' }, 'currentUserAdmin');

server.loadFixtures('schema-blocks');
server.loadFixtures('registration-schemas');
server.create('registration-provider', {
id: defaultProvider,
shareSource: 'OSF Registries',
name: 'OSF Registries',
}, 'withAllSchemas');

const url = `/${node.id}/registrations`;

Expand Down
8 changes: 8 additions & 0 deletions tests/acceptance/resolve-guid-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Service from '@ember/service';
import { currentRouteName, currentURL, settled } from '@ember/test-helpers';
import { getContext } from '@ember/test-helpers/setup-context';
import { setupMirage } from 'ember-cli-mirage/test-support';
import config from 'ember-get-config';
import { setupApplicationTest } from 'ember-qunit';
import { TestContext } from 'ember-test-helpers';
import { module, test } from 'qunit';
Expand Down Expand Up @@ -93,6 +94,13 @@ module('Acceptance | resolve-guid', hooks => {
});

test('Registrations', async assert => {
const { defaultProvider } = config;

server.create('registration-provider', {
id: defaultProvider,
shareSource: 'OSF Registries',
name: 'OSF Registries',
});
const node = server.create('node');

await visit(`/${node.id}/registrations`);
Expand Down
Loading

0 comments on commit 77b1022

Please sign in to comment.