Skip to content

Commit 0156bf7

Browse files
bp-cosadlius
authored andcommitted
Fixes for eng-5940 and eng-5942
1 parent 53ea45e commit 0156bf7

File tree

7 files changed

+63
-15
lines changed

7 files changed

+63
-15
lines changed

app/models/provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface Assets {
2121
wide_white: string;
2222
}
2323

24-
export enum PreprintProviderReviewsWorkFlow{
24+
export enum PreprintProviderReviewsWorkFlow {
2525
PRE_MODERATION = 'pre-moderation',
2626
POST_MODERATION = 'post-moderation'
2727
}

app/preprints/-components/submit/preprint-state-machine/component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,12 @@ export default class PreprintStateMachine extends Component<StateMachineArgs>{
607607
@task
608608
@waitFor
609609
public async addProjectFile(file: FileModel): Promise<void>{
610-
await file.copy(this.preprint, '/', 'osfstorage');
610+
await file.copy(this.preprint, '/', 'osfstorage', {
611+
conflict: 'replace',
612+
});
611613
const theFiles = await this.preprint.files;
612614
const rootFolder = await theFiles.firstObject!.rootFolder;
613615
const primaryFile = await rootFolder!.files;
614-
this.preprint.set('primaryFile', primaryFile.firstObject);
616+
this.preprint.set('primaryFile', primaryFile.lastObject);
615617
}
616618
}

app/preprints/-components/submit/preprint-state-machine/status-flow/status-flow-display/styles.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
background-color: inherit;
1111
z-index: 1;
1212

13-
&.cursor {
14-
cursor: pointer;
15-
}
1613

1714
&.selected {
1815
width: 193px;
@@ -57,6 +54,11 @@
5754
font-weight: bold;
5855
}
5956

57+
&.cursor {
58+
cursor: pointer;
59+
}
60+
61+
6062
.finished {
6163
color: $brand-success;
6264
}

app/preprints/-components/submit/preprint-state-machine/status-flow/status-flow-display/template.hbs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{{#if this.shouldDisplayStatusType}}
22
<div local-class='status-container
33
{{if this.isSelected 'selected'}}
4-
{{if this.isFinished 'cursor'}}
54
{{if (is-mobile) 'mobile'}}'
65
>
76
<div local-class='graphics-container'>
@@ -20,7 +19,9 @@
2019
/>
2120
{{/if}}
2221
</div>
23-
<div local-class='link-container'>
22+
<div local-class='link-container
23+
{{if this.isFinished 'cursor'}}'
24+
>
2425
{{#if this.isFinished}}
2526
<Button
2627
local-class='btn finished'

app/preprints/-components/submit/review/component.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { inject as service } from '@ember/service';
88
import { tracked } from '@glimmer/tracking';
99
import moment from 'moment-timezone';
1010
import Intl from 'ember-intl/services/intl';
11+
import { PreprintProviderReviewsWorkFlow } from 'ember-osf-web/models/provider';
12+
import { SafeString } from '@ember/template/-private/handlebars';
1113

1214
/**
1315
* The Review Args
@@ -27,6 +29,8 @@ export default class Review extends Component<ReviewArgs>{
2729
@tracked contributors?: any;
2830
@tracked subjects?: any;
2931
@service intl!: Intl;
32+
@tracked displayProviderAgreement = false;
33+
@tracked providerAgreement: string | SafeString = '';
3034

3135
constructor(owner: unknown, args: ReviewArgs) {
3236
super(owner, args);
@@ -37,7 +41,25 @@ export default class Review extends Component<ReviewArgs>{
3741
@task
3842
@waitFor
3943
private async loadPreprint() {
40-
this.provider = this.preprint.provider.content;
44+
this.provider = await this.preprint.provider.content;
45+
if (
46+
this.provider.reviewsWorkflow === PreprintProviderReviewsWorkFlow.PRE_MODERATION ||
47+
this.provider.reviewsWorkflow === PreprintProviderReviewsWorkFlow.POST_MODERATION
48+
) {
49+
this.displayProviderAgreement = true;
50+
51+
const moderationType = this.provider.reviewsWorkflow ===
52+
PreprintProviderReviewsWorkFlow.PRE_MODERATION ?
53+
PreprintProviderReviewsWorkFlow.PRE_MODERATION :
54+
PreprintProviderReviewsWorkFlow.POST_MODERATION;
55+
this.providerAgreement = this.intl.t('preprints.submit.step-review.agreement-provider',
56+
{
57+
providerName : this.provider.name,
58+
moderationType,
59+
htmlSafe: true,
60+
});
61+
}
62+
4163
this.license = this.preprint.license;
4264
this.subjects = await this.preprint.queryHasMany('subjects');
4365
}

app/preprints/-components/submit/review/template.hbs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
{{#if this.loadPreprint.isRunning}}
33
<LoadingIndicator data-test-loading-indicator @dark={{true}} />
44
{{else}}
5+
<div local-class='step-container'>
6+
<h3 local-class='title'
7+
data-test-user-agreement-title
8+
>
9+
{{t 'preprints.submit.step-review.agreement-title'}}
10+
</h3>
11+
12+
<div local-class='content-container'>
13+
{{t 'preprints.submit.step-review.agreement-user'}}
14+
</div>
15+
{{#if this.displayProviderAgreement}}
16+
<div local-class='content-container'>
17+
{{this.providerAgreement}}
18+
</div>
19+
{{/if}}
20+
<hr>
21+
</div>
522
<div local-class='step-container'>
623
<h3 local-class='title'
724
data-test-title-step-title

translations/en-us.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,19 +1254,23 @@ preprints:
12541254
delete-modal-title: 'Disconnect supplemental material'
12551255
delete-warning: 'This will disconnect the selected project. You can select new supplemental material or re-add the same supplemental material at a later date.'
12561256
step-review:
1257-
title: 'Review'
1257+
agreement-provider: '{providerName} uses {moderationType}. If your preprint is accepted, it will be assigned a DOI and become publicly accessible via OSF. The preprint file cannot be deleted but it can be updated or modified. You can read more about
1258+
<a href="https://help.osf.io/article/592-preprint-moderation" target="_blank">OSF preprints moderation policies on</a> the OSF support center.'
1259+
agreement-title: 'Consent to publish'
1260+
agreement-user: 'By submitting this preprint you confirm that all contributors agree with sharing it and that you have the right to share this preprint.'
1261+
conflict-of-interest: 'Conflict of Interest'
1262+
contributors: 'Contributors'
1263+
no-conflict-of-interest: 'Author asserted no Conflict of Interest.'
12581264
preprint-service: '{singularPreprintWord} Service'
12591265
preprint-title: 'Title'
1260-
contributors: 'Contributors'
1266+
publication-citation: 'Publication Citation'
12611267
publication-date: 'Publication Date'
12621268
publication-doi: 'Publication DOI'
1263-
publication-citation: 'Publication Citation'
1264-
conflict-of-interest: 'Conflict of Interest'
1265-
no-conflict-of-interest: 'Author asserted no Conflict of Interest.'
12661269
public-data: 'Public Data'
12671270
public-preregistration: 'Public Preregistration'
1268-
supplement-title: 'OSF Project'
12691271
supplement-na: 'Author did not add any supplements for this {singularPreprintWord}'
1272+
supplement-title: 'OSF Project'
1273+
title: 'Review'
12701274
data-analytics: 'Goto {statusType} tab'
12711275
status-flow:
12721276
step-title-and-abstract: 'Title and Abstract'

0 commit comments

Comments
 (0)