Skip to content

Commit c2ba9cb

Browse files
Uditi Mehtacslzchen
authored andcommitted
Fix preprint resubmision workflow for accepted preprints
1 parent 1583fa4 commit c2ba9cb

File tree

1 file changed

+17
-3
lines changed
  • app/preprints/-components/submit/preprint-state-machine

1 file changed

+17
-3
lines changed

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,23 @@ export default class PreprintStateMachine extends Component<StateMachineArgs>{
213213
@waitFor
214214
public async onSubmit(): Promise<void> {
215215
this.args.resetPageDirty();
216-
if (!this.isEditFlow) {
216+
217+
if (this.isEditFlow) {
218+
if (this.preprint.reviewsState !== ReviewsState.ACCEPTED) {
219+
if (this.provider.reviewsWorkflow) {
220+
const reviewAction = this.store.createRecord('review-action', {
221+
actionTrigger: 'submit',
222+
target: this.preprint,
223+
});
224+
await reviewAction.save();
225+
} else {
226+
this.preprint.isPublished = true;
227+
await this.preprint.save();
228+
}
229+
} else {
230+
await this.preprint.save();
231+
}
232+
} else {
217233
if (this.provider.reviewsWorkflow) {
218234
const reviewAction = this.store.createRecord('review-action', {
219235
actionTrigger: 'submit',
@@ -224,11 +240,9 @@ export default class PreprintStateMachine extends Component<StateMachineArgs>{
224240
this.preprint.isPublished = true;
225241
await this.preprint.save();
226242
}
227-
228243
}
229244

230245
await this.preprint.reload();
231-
232246
await this.router.transitionTo('preprints.detail', this.provider.id, this.preprint.id);
233247
}
234248

0 commit comments

Comments
 (0)