From 57fcd090119555602afc2dd6532c1fb0e9dfa8ba Mon Sep 17 00:00:00 2001 From: Longze Chen Date: Mon, 20 Jan 2025 12:15:00 -0500 Subject: [PATCH] Revert "Fix bug to allow any contributor to see preprint rejection comments (#2482)" This reverts commit a2eb33f811064f03ece13f372c11ad8c9d76f3c8. --- app/preprints/detail/route.ts | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/app/preprints/detail/route.ts b/app/preprints/detail/route.ts index 1c93c8b3aa..79f99ea1be 100644 --- a/app/preprints/detail/route.ts +++ b/app/preprints/detail/route.ts @@ -96,22 +96,20 @@ export default class PreprintsDetail extends Route { let hasPendingWithdrawal = false; let latestWithdrawalRequest = null; let latestAction = null; - if (preprint.currentUserPermissions.length > 0) { + if (preprintWithdrawableState && preprint.currentUserIsAdmin) { const reviewActions = await preprint?.queryHasMany('reviewActions'); latestAction = reviewActions.firstObject; - if (preprintWithdrawableState) { - const withdrawalRequests = await preprint?.queryHasMany('requests'); - latestWithdrawalRequest = withdrawalRequests.firstObject; - if (latestWithdrawalRequest) { - hasPendingWithdrawal = latestWithdrawalRequest.machineState === 'pending'; - const requestActions = await withdrawalRequests.firstObject?.queryHasMany('actions', { - sort: '-modified', - }); - latestAction = requestActions.firstObject; - // @ts-ignore: ActionTrigger is never - if (latestAction && latestAction.actionTrigger === 'reject') { - isWithdrawalRejected = true; - } + const withdrawalRequests = await preprint?.queryHasMany('requests'); + latestWithdrawalRequest = withdrawalRequests.firstObject; + if (latestWithdrawalRequest) { + hasPendingWithdrawal = latestWithdrawalRequest.machineState === 'pending'; + const requestActions = await withdrawalRequests.firstObject?.queryHasMany('actions', { + sort: '-modified', + }); + latestAction = requestActions.firstObject; + // @ts-ignore: ActionTrigger is never + if (latestAction && latestAction.actionTrigger === 'reject') { + isWithdrawalRejected = true; } } }