Skip to content

Commit

Permalink
pkp/pkp-lib#10744 Increase opportunity for ORCID work/review deposits
Browse files Browse the repository at this point in the history
  • Loading branch information
taslangraham committed Dec 31, 2024
1 parent 03b9392 commit 5be3b2e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/managers/ReviewerManager/reviewerManagerStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ export const useReviewerManagerStore = defineComponentStore(
return _actionFns.getItemPrimaryActions(args);
}

function reviewerSendToOrcid({reviewAssignment}) {
return _actionFns.reviewerSendToOrcid(getActionArgs({reviewAssignment}));
}

return {
getReviewMethodIcons,
reviewAssignments,
Expand All @@ -198,6 +202,7 @@ export const useReviewerManagerStore = defineComponentStore(
reviewerRevertConsider,
reviewerSendReminder,
reviewerLogResponse,
reviewerSendToOrcid,
_reviewerManagerActionFns: _actionFns,
};
},
Expand Down
58 changes: 58 additions & 0 deletions src/managers/ReviewerManager/useReviewerManagerActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const Actions = {
REVIEWER_REVERT_CONSIDER: 'reviewerRevertConsider',
REVIEWER_SEND_REMINDER: 'reviewerSendReminder',
REVIEWER_LOG_RESPONSE: 'reviewerLogResponse',
REVIEWER_SEND_TO_ORCID: 'reviewerSendToOrcid',
};

export function useReviewerManagerActions() {
Expand Down Expand Up @@ -198,6 +199,18 @@ export function useReviewerManagerActions() {
});
}

// ORCID reviewer deposit
if (
reviewAssignment.reviewerHasOrcid &&
pkp.const.REVIEW_ASSIGNMENT_STATUS_COMPLETE
) {
actions.push({
label: t('dashboard.reviewAssignment.action.sendReviewToOrcid'),
name: Actions.REVIEWER_SEND_TO_ORCID,
icon: 'Orcid',
});
}

return actions;
}

Expand Down Expand Up @@ -609,6 +622,50 @@ export function useReviewerManagerActions() {
);
}

function reviewerSendToOrcid({
submission,
reviewAssignment,
submissionStageId,
}) {
const {openDialog, openDialogNetworkError} = useModal();

let submissionId = submission.id;

openDialog({
actions: [
{
label: t('common.ok'),
isPrimary: true,
callback: async (close) => {
const {apiUrl} = useApiUrl(
`reviews/${submissionId}/${reviewAssignment.id}/sendToOrcid`,
);

const formData = new FormData();
formData.append('csrfToken', getCSRFToken());

const {fetch, isSuccess} = useFetch(apiUrl, {
method: 'POST',
body: formData,
});

await fetch();
close();
if (!isSuccess.value) {
openDialogNetworkError();
}
},
},
{
label: t('common.cancel'),
callback: (close) => close(),
},
],
title: t('dashboard.reviewAssignment.action.sendReviewToOrcid'),
message: t('dashboard.reviewAssignment.action.sendReviewToOrcid.confirm'),
});
}

return {
getTopActions,
getItemActions,
Expand All @@ -630,5 +687,6 @@ export function useReviewerManagerActions() {
reviewerRevertConsider,
reviewerSendReminder,
reviewerLogResponse,
reviewerSendToOrcid,
};
}

0 comments on commit 5be3b2e

Please sign in to comment.