From 2cabfb9bab271c5c27dc7e8d544cb4fe1fe2bbbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarda=20Kot=C4=9B=C5=A1ovec?= Date: Tue, 14 Jan 2025 11:01:50 +0100 Subject: [PATCH 1/3] pkp/pkp-lib#10480 Update UI to use new fields for recommend only scenario --- src/composables/useSubmission.js | 9 --- .../action/WorkflowRecommendOnlyControls.vue | 60 +++------------ ...lowRecommendOnlyListingRecommendations.vue | 73 +++---------------- .../workflowConfigEditorialOJS.js | 5 +- .../workflowConfigEditorialOMP.js | 5 +- .../composables/useWorkflowPermissions.js | 17 +---- 6 files changed, 24 insertions(+), 145 deletions(-) diff --git a/src/composables/useSubmission.js b/src/composables/useSubmission.js index 8a356a39a..b1d1252d9 100644 --- a/src/composables/useSubmission.js +++ b/src/composables/useSubmission.js @@ -232,14 +232,6 @@ export function useSubmission() { return ['OpenReview', 'OpenReview']; } - function getRecommendOnlyUserIdsForStage(submission, stageId) { - const stage = getStageById(submission, stageId); - - return stage.stageAssignments - .filter((assignment) => assignment.recommendOnly) - .map((assignment) => assignment.userId); - } - function isDecisionAvailable(submission, decisionId) { const stage = getActiveStage(submission); return stage?.availableEditorialDecisions?.some( @@ -268,7 +260,6 @@ export function useSubmission() { getOpenReviewAssignmentsForRound, getReviewMethodIcons, InProgressReviewAssignmentStatuses, - getRecommendOnlyUserIdsForStage, isDecisionAvailable, }; } diff --git a/src/pages/workflow/components/action/WorkflowRecommendOnlyControls.vue b/src/pages/workflow/components/action/WorkflowRecommendOnlyControls.vue index 66029b15b..9d37b4e22 100644 --- a/src/pages/workflow/components/action/WorkflowRecommendOnlyControls.vue +++ b/src/pages/workflow/components/action/WorkflowRecommendOnlyControls.vue @@ -13,7 +13,7 @@ class="flex flex-col border-t border-light p-4" >

- {{ currentRecommendation.label }} + {{ currentRecommendation }}

@@ -40,11 +40,10 @@ diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js index 23f3b63ad..755bfbb7a 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js @@ -299,10 +299,8 @@ export const WorkflowConfig = { return []; } - // TODO add isDecidingEditor boolean to api to make it more accurate const selectedStage = getStageById(submission, selectedStageId); - const isRecommendOnlyEditor = selectedStage.currentUserCanRecommendOnly; - if (!isRecommendOnlyEditor) { + if (selectedStage?.isCurrentUserDecidingEditor) { items.push({ component: 'WorkflowRecommendOnlyListingRecommendations', props: { @@ -312,6 +310,7 @@ export const WorkflowConfig = { }, }); } + items.push({ component: 'ParticipantManager', props: { diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js index a9d160b6e..34788a833 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js @@ -223,10 +223,8 @@ export const WorkflowConfig = { return []; } - // TODO add isDecidingEditor boolean to api to make it more accurate const selectedStage = getStageById(submission, selectedStageId); - const isRecommendOnlyEditor = selectedStage.currentUserCanRecommendOnly; - if (!isRecommendOnlyEditor) { + if (selectedStage?.isCurrentUserDecidingEditor) { items.push({ component: 'WorkflowRecommendOnlyListingRecommendations', props: { @@ -236,6 +234,7 @@ export const WorkflowConfig = { }, }); } + items.push({ component: 'ParticipantManager', props: { diff --git a/src/pages/workflow/composables/useWorkflowPermissions.js b/src/pages/workflow/composables/useWorkflowPermissions.js index 87517d0a2..45d567e7d 100644 --- a/src/pages/workflow/composables/useWorkflowPermissions.js +++ b/src/pages/workflow/composables/useWorkflowPermissions.js @@ -1,6 +1,6 @@ import {computed} from 'vue'; import {useSubmission} from '@/composables/useSubmission'; -import {EditorialRoles, useCurrentUser} from '@/composables/useCurrentUser'; +import {EditorialRoles} from '@/composables/useCurrentUser'; function hasIntersection(arr1, arr2) { const set = new Set(arr1); @@ -9,7 +9,6 @@ function hasIntersection(arr1, arr2) { export function useWorkflowPermissions({submission, selectedPublication}) { const {getActiveStage, getStageById} = useSubmission(); - const {hasCurrentUserAtLeastOneRole} = useCurrentUser(); const permissions = computed(() => { // View title, metadata, etc. @@ -49,19 +48,7 @@ export function useWorkflowPermissions({submission, selectedPublication}) { } }); - // TODO this will be replaced by with one flag from backend - productionStage.stageAssignments - .filter( - (stageAssignment) => stageAssignment.userId === pkp.currentUser.id, - ) - .forEach((stageAssignment) => { - if (stageAssignment.canChangeMetadata) { - canEditPublication = true; - } - }); - if (hasCurrentUserAtLeastOneRole([pkp.const.ROLE_ID_MANAGER])) { - canEditPublication = true; - } + canEditPublication = submission.value.canCurrentUserChangeMetadata; if ( selectedPublication.value && From 7e5af352d377c1bcd17b3100c7c90e33632a7172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarda=20Kot=C4=9B=C5=A1ovec?= Date: Tue, 14 Jan 2025 11:54:14 +0100 Subject: [PATCH 2/3] pkp/pkp-lib#10761 Tweak publication version UI --- .../publication/WorkflowPublicationVersionControl.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workflow/components/publication/WorkflowPublicationVersionControl.vue b/src/pages/workflow/components/publication/WorkflowPublicationVersionControl.vue index 320832fc8..b11c9fbef 100644 --- a/src/pages/workflow/components/publication/WorkflowPublicationVersionControl.vue +++ b/src/pages/workflow/components/publication/WorkflowPublicationVersionControl.vue @@ -9,10 +9,10 @@ aria-hidden="true" /> {{ statusProps.label }} - + {{ t('semicolon', {label: t('admin.version')}) }} - + {{ selectedPublication.version }} From 70190a33b71a77e8c24ff4bb2c403fa4c9908bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarda=20Kot=C4=9B=C5=A1ovec?= Date: Wed, 15 Jan 2025 14:48:52 +0100 Subject: [PATCH 3/3] pkp/pkp-lib#10480 Update availableEditorialDecisions which is now directly under submission --- src/composables/useSubmission.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/composables/useSubmission.js b/src/composables/useSubmission.js index b1d1252d9..27886b5a7 100644 --- a/src/composables/useSubmission.js +++ b/src/composables/useSubmission.js @@ -234,8 +234,8 @@ export function useSubmission() { function isDecisionAvailable(submission, decisionId) { const stage = getActiveStage(submission); - return stage?.availableEditorialDecisions?.some( - (decision) => decision.id === decisionId, + return submission?.availableEditorialDecisions?.some( + (decision) => decision.id === decisionId && decision.stageId === stage.id, ); }