Skip to content

Commit

Permalink
Revert "Fix bug to allow any contributor to see preprint rejection co…
Browse files Browse the repository at this point in the history
…mments (CenterForOpenScience#2482)"

This reverts commit a2eb33f.
  • Loading branch information
cslzchen committed Jan 20, 2025
1 parent a2eb33f commit 57fcd09
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions app/preprints/detail/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 57fcd09

Please sign in to comment.