Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#10744 Increase opportunity for ORCID work/review deposits #473

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
57 changes: 57 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,49 @@ export function useReviewerManagerActions() {
);
}

function reviewerSendToOrcid({
submission,
reviewAssignment,
}) {
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 +686,6 @@ export function useReviewerManagerActions() {
reviewerRevertConsider,
reviewerSendReminder,
reviewerLogResponse,
reviewerSendToOrcid,
};
}
Loading