Skip to content

Commit 99170e7

Browse files
Uditi Mehtacslzchen
authored andcommitted
Simplify submit logic
1 parent c2ba9cb commit 99170e7

File tree

1 file changed

+10
-25
lines changed
  • app/preprints/-components/submit/preprint-state-machine

1 file changed

+10
-25
lines changed

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

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -214,32 +214,17 @@ export default class PreprintStateMachine extends Component<StateMachineArgs>{
214214
public async onSubmit(): Promise<void> {
215215
this.args.resetPageDirty();
216216

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-
}
217+
if (this.preprint.reviewsState === ReviewsState.ACCEPTED) {
218+
await this.preprint.save();
219+
} else if (this.provider.reviewsWorkflow) {
220+
const reviewAction = this.store.createRecord('review-action', {
221+
actionTrigger: 'submit',
222+
target: this.preprint,
223+
});
224+
await reviewAction.save();
232225
} else {
233-
if (this.provider.reviewsWorkflow) {
234-
const reviewAction = this.store.createRecord('review-action', {
235-
actionTrigger: 'submit',
236-
target: this.preprint,
237-
});
238-
await reviewAction.save();
239-
} else {
240-
this.preprint.isPublished = true;
241-
await this.preprint.save();
242-
}
226+
this.preprint.isPublished = true;
227+
await this.preprint.save();
243228
}
244229

245230
await this.preprint.reload();

0 commit comments

Comments
 (0)