From 0b353c582bae87f2a94e15d40a4a453a10b132aa Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Thu, 9 Jan 2025 17:59:10 -0500 Subject: [PATCH] Make logic easier to read --- app/preprints/detail/controller.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/preprints/detail/controller.ts b/app/preprints/detail/controller.ts index e062c3654c..4ab7484b4f 100644 --- a/app/preprints/detail/controller.ts +++ b/app/preprints/detail/controller.ts @@ -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;