Skip to content

Commit bbf339d

Browse files
committed
Merge branch 'release/20.4.0'
2 parents bbfe7fc + aa0c0e1 commit bbf339d

File tree

133 files changed

+1125
-697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+1125
-697
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- yarn lint:es
3434
- yarn lint:ts
3535
- yarn lint:style
36-
#- yarn lint:template
36+
- yarn lint:template
3737
- yarn test:node-tests
3838
- yarn build:test
3939
script:

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ 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+
## [20.4.0] - 2020-05-26
8+
### Changed
9+
- link to institutions
10+
- wording of OSFInstitutions
11+
- config to use `isTruthy`
12+
- draft-registration card component to remove progress-bar
13+
14+
### Added
15+
- newline to "Read more" link
16+
- logging API error messages
17+
- CI template linting
18+
- log API draft-registration submission error
19+
20+
### Fixed
21+
- file links issue on overview page
22+
723
## [20.3.1] - 2020-03-26
824
### Fixed
925
- `active` schemas filter parameter.
@@ -1576,7 +1592,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
15761592
### Added
15771593
- Quick Files
15781594

1579-
[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/20.3.1...develop
1595+
[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/20.4.0...develop
1596+
[20.4.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.4.0
15801597
[20.3.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.3.1
15811598
[20.3.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.3.0
15821599
[20.2.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.2.1

app/application/-components/verify-email-modal/component.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Toast from 'ember-toastr/services/toast';
1010

1111
import UserEmail from 'ember-osf-web/models/user-email';
1212
import CurrentUser from 'ember-osf-web/services/current-user';
13+
import captureException, { getApiErrorMessage } from 'ember-osf-web/utils/capture-exception';
1314

1415
interface TranslationKeys {
1516
header: string;
@@ -119,14 +120,24 @@ export default class VerifyEmailModal extends Component {
119120
this.unverifiedEmails.shiftObject();
120121
}
121122

122-
this.showMessage(successMessageLevel, successKey, userEmail);
123+
this.toast[successMessageLevel](
124+
this.intl.t(
125+
this.translationKeys[successKey],
126+
{ email: userEmail.emailAddress, htmlSafe: true },
127+
),
128+
);
123129

124130
// Close the modal and open another one (if needed) because it's confusing for the text to change in place
125131
this.set('shouldShowModal', false);
126132
yield timeout(300);
127133
this.set('shouldShowModal', true);
128134
} catch (e) {
129-
this.showMessage('error', errorKey, userEmail);
135+
const errorMessage = this.intl.t(
136+
this.translationKeys[errorKey],
137+
{ email: userEmail.emailAddress, htmlSafe: true },
138+
);
139+
captureException(e, { errorMessage });
140+
this.toast.error(getApiErrorMessage(e), errorMessage);
130141
throw e;
131142
}
132143
});
@@ -136,19 +147,6 @@ export default class VerifyEmailModal extends Component {
136147
this.loadEmailsTask.perform();
137148
}
138149

139-
showMessage(
140-
level: MessageLevel,
141-
key: keyof TranslationKeys,
142-
userEmail: UserEmail,
143-
) {
144-
this.toast[level](
145-
this.intl.t(
146-
this.translationKeys[key],
147-
{ email: userEmail.emailAddress, htmlSafe: true },
148-
),
149-
);
150-
}
151-
152150
@action
153151
verify() {
154152
this.verifyTask.perform(EmailActions.Verify);

app/application/template.hbs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@
88
{{#unless this.disableHeader}}
99
{{#if this.theme.isProvider}}
1010
<style>
11-
{{! template-lint-disable bare-strings }}
11+
{{!-- template-lint-disable no-bare-strings --}}
1212
@import url('{{this.theme.stylesheet}}');
13-
{{! template-lint-enable bare-strings }}
13+
{{!-- template-lint-enable no-bare-strings --}}
1414
</style>
1515
<div id='branded-navbar'></div>
1616
{{else}}
1717
<OsfHeader />
1818
{{/if}}
1919
{{/unless}}
2020
{{#if this.shouldShowVerifyEmailModals}}
21-
{{! template-lint-disable no-implicit-this }}
22-
{{application/-components/verify-email-modal}}
23-
{{! template-lint-enable no-implicit-this }}
21+
<Application::-Components::VerifyEmailModal />
2422
{{/if}}
2523
{{!--
2624
NOTE: the global Application__page class is used in registries

app/guid-file/controller.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import { timeout } from 'ember-concurrency';
77
import { task } from 'ember-concurrency-decorators';
88
import config from 'ember-get-config';
99
import Intl from 'ember-intl/services/intl';
10+
import Toast from 'ember-toastr/services/toast';
11+
1012
import mimeTypes from 'ember-osf-web/const/mime-types';
1113
import File from 'ember-osf-web/models/file';
1214
import User from 'ember-osf-web/models/user';
1315
import Analytics from 'ember-osf-web/services/analytics';
1416
import CurrentUser from 'ember-osf-web/services/current-user';
17+
import captureException, { getApiErrorMessage } from 'ember-osf-web/utils/capture-exception';
1518
import pathJoin from 'ember-osf-web/utils/path-join';
16-
import Toast from 'ember-toastr/services/toast';
1719
import $ from 'jquery';
1820
import mime from 'mime-types';
1921

@@ -141,8 +143,9 @@ export default class GuidFile extends Controller {
141143
const message: string = this.intl.t('file_detail.delete_success');
142144
return this.toast.success(message);
143145
} catch (e) {
144-
const message: string = this.intl.t('file_detail.delete_fail');
145-
return this.toast.error(message);
146+
const errorMessage: string = this.intl.t('file_detail.delete_fail');
147+
captureException(e, { errorMessage });
148+
return this.toast.error(getApiErrorMessage(e), errorMessage);
146149
}
147150
}
148151

@@ -163,7 +166,9 @@ export default class GuidFile extends Controller {
163166
await this.file.updateContents(text);
164167
return this.toast.success(this.intl.t('file_detail.save_success'));
165168
} catch (e) {
166-
return this.toast.error(this.intl.t('file_detail.save_fail'));
169+
const errorMessage = this.intl.t('file_detail.save_fail');
170+
captureException(e, { errorMessage });
171+
return this.toast.error(getApiErrorMessage(e), errorMessage);
167172
}
168173
}
169174

app/guid-file/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
{{/if}}
3636
<div class='btn-group m-l-xs m-t-xs'>
3737
<OsfButton
38-
data-analytics-name={{if (not this.canEdit) 'Download'}}
38+
data-analytics-name={{unless this.canEdit 'Download'}}
3939
data-test-download-button
4040
@bubble={{true}}
4141
@type='primary'

app/guid-user/quickfiles/controller.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Node from 'ember-osf-web/models/node';
1313
import User from 'ember-osf-web/models/user';
1414
import Analytics from 'ember-osf-web/services/analytics';
1515
import CurrentUser from 'ember-osf-web/services/current-user';
16+
import captureException, { getApiErrorMessage } from 'ember-osf-web/utils/capture-exception';
1617

1718
export default class UserQuickfiles extends Controller {
1819
@service analytics!: Analytics;
@@ -41,8 +42,10 @@ export default class UserQuickfiles extends Controller {
4142
createProject = task(function *(this: UserQuickfiles, node: Node) {
4243
try {
4344
return yield node.save();
44-
} catch (ex) {
45-
this.toast.error(this.intl.t('move_to_project.could_not_create_project'));
45+
} catch (e) {
46+
const errorMessage = this.intl.t('move_to_project.could_not_create_project');
47+
captureException(e, { errorMessage });
48+
this.toast.error(getApiErrorMessage(e), errorMessage);
4649
return undefined;
4750
}
4851
});

app/home/-components/testimonials/template.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! template-lint-disable no-bare-strings }}
21
<section
32
data-test-testimonials-container
43
local-class='container'

app/institutions/index/template.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
<div local-class='Institutions__header-logo'></div>
1616
<p class='lead'>
1717
{{t 'institutions.description'}}
18+
<br>
1819
<OsfLink
1920
data-test-read-more-link
2021
data-analytics-name='Read more'
2122
local-class='Institutions__block__link'
22-
@href='https://cos.io/our-products/osf-institutions/'
23+
@href='https://cos.io/institutions/'
2324
>
2425
{{t 'institutions.read_more'}}
2526
</OsfLink>

app/serializers/registration.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,22 @@ import {
66
} from 'ember-osf-web/packages/registration-schema';
77
import { normalizeRegistrationResponses } from 'ember-osf-web/serializers/draft-registration';
88
import { mapKeysAndValues } from 'ember-osf-web/utils/map-keys';
9-
import { SingleResourceDocument } from 'osf-api';
9+
import { Resource } from 'osf-api';
1010
import OsfSerializer from './osf-serializer';
1111

1212
export default class RegistrationSerializer extends OsfSerializer {
13-
normalizeResponse(
14-
store: DS.Store,
15-
primaryModelClass: any,
16-
payload: SingleResourceDocument,
17-
id: string,
18-
requestType: string,
19-
) {
20-
if (payload.data.attributes) {
21-
const registrationResponses = payload.data.attributes.registration_responses as RegistrationResponse;
13+
normalize(modelClass: DS.Model, resourceHash: Resource) {
14+
if (resourceHash.attributes) {
15+
const registrationResponses = resourceHash.attributes.registration_responses as RegistrationResponse;
2216
// @ts-ignore
2317
// eslint-disable-next-line no-param-reassign
24-
payload.data.attributes.registration_responses = mapKeysAndValues(
18+
resourceHash.attributes.registration_responses = mapKeysAndValues(
2519
registrationResponses || {},
2620
key => key,
27-
value => normalizeRegistrationResponses(value, store),
21+
value => normalizeRegistrationResponses(value, this.store),
2822
) as NormalizedRegistrationResponse;
2923
}
30-
return super.normalizeResponse(store, primaryModelClass, payload, id, requestType);
24+
return super.normalize(modelClass, resourceHash) as { data: Resource };
3125
}
3226
}
3327

0 commit comments

Comments
 (0)