Skip to content

Commit 2c6792f

Browse files
committed
pkp/pkp-lib#10263 Relax editing metadata on published/posted materials
1 parent 041e92a commit 2c6792f

File tree

8 files changed

+35
-36
lines changed

8 files changed

+35
-36
lines changed

src/components/ListPanel/contributors/ContributorsListPanel.vue

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
<Spinner v-if="isLoading" />
1313
<template #actions>
1414
<PkpButton
15-
v-if="
16-
publication.status !== getConstant('STATUS_PUBLISHED') &&
17-
canEditPublication
18-
"
15+
v-if="canEditPublication"
1916
icon="Sort"
2017
:is-active="isOrdering"
2118
:disabled="isLoading"
@@ -39,11 +36,7 @@
3936
{{ t('contributor.listPanel.preview') }}
4037
</PkpButton>
4138
<PkpButton
42-
v-if="
43-
!isOrdering &&
44-
publication.status !== getConstant('STATUS_PUBLISHED') &&
45-
canEditPublication
46-
"
39+
v-if="!isOrdering && canEditPublication"
4740
:disabled="isLoading"
4841
@click="openAddModal"
4942
>
@@ -65,13 +58,7 @@
6558
{{ localize(item.affiliation) }}
6659
</div>
6760
</template>
68-
<template
69-
v-if="
70-
publication.status !== getConstant('STATUS_PUBLISHED') &&
71-
canEditPublication
72-
"
73-
#item-actions="{item}"
74-
>
61+
<template v-if="canEditPublication" #item-actions="{item}">
7562
<template v-if="isOrdering">
7663
<Orderer
7764
:item-id="item.id"

src/managers/GalleyManager/useGalleyManagerConfig.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ export const GalleyManagerConfiguration = {
3434
Actions.GALLEY_EDIT,
3535
Actions.GALLEY_SORT,
3636
],
37-
actionsRequiresUnpublishedState: [
38-
Actions.GALLEY_ADD,
39-
Actions.GALLEY_CHANGE_FILE,
40-
Actions.GALLEY_DELETE,
41-
Actions.GALLEY_SORT,
42-
],
4337
};
4438

4539
export function useGalleyManagerConfig() {
@@ -84,15 +78,6 @@ export function useGalleyManagerConfig() {
8478
function getManagerConfig({submission, publication}) {
8579
const permittedActions = GalleyManagerConfiguration.actions
8680
.filter((action) => {
87-
if (
88-
publication.value.status === pkp.const.STATUS_PUBLISHED &&
89-
GalleyManagerConfiguration.actionsRequiresUnpublishedState.includes(
90-
action,
91-
)
92-
) {
93-
return false;
94-
}
95-
9681
return true;
9782
})
9883
.filter((action) => {

src/pages/workflow/WorkflowPageOJS.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import WorkflowPublicationVersionControl from './components/publication/Workflow
2828
import WorkflowChangeSubmissionLanguage from './components/publication/WorkflowChangeSubmissionLanguage.vue';
2929
import WorkflowPrimaryBasicMetadata from './components/primary/WorkflowPrimaryBasicMetadata.vue';
3030
import WorkflowSubmissionStatus from './components/primary/WorkflowSubmissionStatus.vue';
31+
import WorkflowPublicationEditWarning from './components/publication/WorkflowPublicationEditWarning.vue';
3132
import WorkflowPublicationEditDisabled from './components/publication/WorkflowPublicationEditDisabled.vue';
3233
3334
import {useWorkflowConfigOJS as useWorkflowConfig} from './composables/useWorkflowConfig/useWorkflowConfigOJS';
@@ -65,6 +66,7 @@ const Components = markRaw({
6566
WorkflowPublicationVersionControl,
6667
WorkflowChangeSubmissionLanguage,
6768
WorkflowSubmissionStatus,
69+
WorkflowPublicationEditWarning,
6870
WorkflowPublicationEditDisabled,
6971
});
7072

src/pages/workflow/WorkflowPageOMP.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import WorkflowPublicationVersionControl from './components/publication/Workflow
3232
import WorkflowChangeSubmissionLanguage from './components/publication/WorkflowChangeSubmissionLanguage.vue';
3333
import WorkflowPrimaryBasicMetadata from './components/primary/WorkflowPrimaryBasicMetadata.vue';
3434
import WorkflowSubmissionStatus from './components/primary/WorkflowSubmissionStatus.vue';
35+
import WorkflowPublicationEditWarning from './components/publication/WorkflowPublicationEditWarning.vue';
3536
import WorkflowPublicationEditDisabled from './components/publication/WorkflowPublicationEditDisabled.vue';
3637
3738
const props = defineProps({
@@ -66,6 +67,7 @@ const Components = markRaw({
6667
WorkflowPublicationVersionControl,
6768
WorkflowChangeSubmissionLanguage,
6869
WorkflowSubmissionStatus,
70+
WorkflowPublicationEditWarning,
6971
WorkflowPublicationEditDisabled,
7072
WorkflowMarketingForm,
7173
WorkflowWorkTypeOMP,

src/pages/workflow/WorkflowPageOPS.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import WorkflowChangeSubmissionLanguage from './components/publication/WorkflowC
2626
import WorkflowPrimaryBasicMetadata from './components/primary/WorkflowPrimaryBasicMetadata.vue';
2727
import WorkflowPublicationRelationDropdownOPS from './components/publication/WorkflowPublicationRelationDropdownOPS.vue';
2828
import WorkflowSubmissionStatus from './components/primary/WorkflowSubmissionStatus.vue';
29+
import WorkflowPublicationEditWarning from './components/publication/WorkflowPublicationEditWarning.vue';
2930
import WorkflowPublicationEditDisabled from './components/publication/WorkflowPublicationEditDisabled.vue';
3031
3132
const props = defineProps({
@@ -55,6 +56,7 @@ const Components = markRaw({
5556
WorkflowPublicationVersionControl,
5657
WorkflowChangeSubmissionLanguage,
5758
WorkflowSubmissionStatus,
59+
WorkflowPublicationEditWarning,
5860
WorkflowPublicationEditDisabled,
5961
});
6062
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- file: WorkflowPublicationEditWarning.vue -->
2+
<template>
3+
<div
4+
class="bg -mx-5 -mt-5 bg-attention p-5 text-center text-base-normal text-on-dark"
5+
>
6+
{{ t('publication.editorEditWarning') }}
7+
</div>
8+
</template>
9+
10+
<script setup>
11+
import {useLocalize} from '@/composables/useLocalize';
12+
const {t} = useLocalize();
13+
</script>

src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ export const PublicationConfig = {
718718
const items = [];
719719
if (selectedPublication.status === pkp.const.STATUS_PUBLISHED) {
720720
items.push({
721-
component: 'WorkflowPublicationEditDisabled',
721+
component: 'WorkflowPublicationEditWarning',
722722
props: {},
723723
});
724724
}
@@ -958,6 +958,7 @@ export const PublicationConfig = {
958958
props: {
959959
submission,
960960
publication: selectedPublication,
961+
canEdit: permissions.canEditPublication,
961962
},
962963
},
963964
];

src/pages/workflow/composables/useWorkflowPermissions.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,17 @@ export function useWorkflowPermissions({submission, selectedPublication}) {
5050

5151
canEditPublication = submission.value.canCurrentUserChangeMetadata;
5252

53-
if (
54-
selectedPublication.value &&
55-
selectedPublication.value?.status === pkp.const.STATUS_PUBLISHED
56-
) {
53+
const isAuthor = hasIntersection(activeStage.currentUserAssignedRoles, [
54+
pkp.const.ROLE_ID_AUTHOR,
55+
]);
56+
// block authors from editing any version if there is a published or scheduled version
57+
const hasBlockedPublication = submission.value.publications.some((p) =>
58+
[pkp.const.STATUS_PUBLISHED, pkp.const.STATUS_SCHEDULED].includes(
59+
p.status,
60+
),
61+
);
62+
63+
if (isAuthor && hasBlockedPublication) {
5764
canEditPublication = false;
5865
}
5966

0 commit comments

Comments
 (0)