Skip to content

Commit

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

-   Ticket: []
-   Feature flag: n/a

## Purpose
- Fix bug which prevented users from seeing moderator feedback

## Summary of Changes
- Decouple fetching the latest review-action to preprint-state
- Allow all preprint contributors to see moderator feedback
  • Loading branch information
futa-ikeda authored Jan 17, 2025
1 parent 08b0aa5 commit a2eb33f
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions app/preprints/detail/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,22 @@ export default class PreprintsDetail extends Route {
let hasPendingWithdrawal = false;
let latestWithdrawalRequest = null;
let latestAction = null;
if (preprintWithdrawableState && preprint.currentUserIsAdmin) {
if (preprint.currentUserPermissions.length > 0) {
const reviewActions = await preprint?.queryHasMany('reviewActions');
latestAction = reviewActions.firstObject;
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;
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;
}
}
}
}
Expand Down

0 comments on commit a2eb33f

Please sign in to comment.