Skip to content

Commit

Permalink
Make logic easier to read
Browse files Browse the repository at this point in the history
  • Loading branch information
futa-ikeda committed Jan 9, 2025
1 parent a308763 commit 0b353c5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions app/preprints/detail/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,20 @@ export default class PrePrintsDetailController extends Controller {
return false;
}

if (this.model.preprint.isLatestVersion) {
if (this.model.preprint.isLatestVersion || this.model.preprint.reviewsState === ReviewsState.INITIAL) {
return true;
} else {
if (this.model.preprint.reviewsState === ReviewsState.INITIAL) {
return true;
}
if (providerIsPremod && this.model.preprint.reviewsState === ReviewsState.PENDING) {
}
if (providerIsPremod) {
if (this.model.preprint.reviewsState === ReviewsState.PENDING) {
return true;
}
// Edit and resubmit
if (providerIsPremod && preprintIsFirstVersion && preprintIsRejected
if (preprintIsFirstVersion && preprintIsRejected
&& this.model.preprint.currentUserIsAdmin) {
return true;
}
return false;
}
return false;
}
get editButtonLabel(): string {
const providerIsPremod = this.model.provider.reviewsWorkflow === PreprintProviderReviewsWorkFlow.PRE_MODERATION;
Expand Down

0 comments on commit 0b353c5

Please sign in to comment.