fix(core): Publish indicator not shown when lacking publish scope (no-changelog) (#24266)

This commit is contained in:
Konstantin Tieber
2026-01-14 14:48:15 +00:00
committed by GitHub
parent 5ba0bf78c1
commit 06f8dbcb21
2 changed files with 35 additions and 3 deletions
@@ -140,6 +140,7 @@ describe('WorkflowHeaderDraftPublishActions', () => {
const { queryByTestId } = renderComponent();
expect(queryByTestId('workflow-active-version-info')).not.toBeInTheDocument();
expect(queryByTestId('workflow-active-version-indicator')).not.toBeInTheDocument();
});
@@ -148,6 +149,7 @@ describe('WorkflowHeaderDraftPublishActions', () => {
const { getByTestId } = renderComponent();
expect(getByTestId('workflow-active-version-info')).toBeInTheDocument();
expect(getByTestId('workflow-active-version-indicator')).toBeInTheDocument();
});
@@ -199,9 +201,27 @@ describe('WorkflowHeaderDraftPublishActions', () => {
},
});
expect(getByTestId('workflow-active-version-indicator')).toBeInTheDocument();
expect(getByTestId('workflow-active-version-info')).toBeInTheDocument();
expect(getByTestId('time-ago-stub')).toHaveTextContent(latestActivationDate);
});
it('should show active version indicator when user does not have workflow:publish permission but workflow is currently published', () => {
workflowsStore.workflow.activeVersion = createMockActiveVersion('active-version-1');
const { getByTestId } = renderComponent({
props: {
...defaultWorkflowProps,
readOnly: false,
workflowPermissions: {
...defaultWorkflowProps.workflowPermissions,
update: true,
publish: false,
},
},
});
expect(getByTestId('workflow-active-version-indicator')).toBeInTheDocument();
expect(getByTestId('workflow-active-version-info')).toBeInTheDocument();
});
});
describe('Publish button visibility', () => {
@@ -150,7 +150,7 @@ const onPublishButtonClick = async () => {
const publishButtonConfig = computed(() => {
// Handle permission-denied state first
if (!props.workflowPermissions.publish) {
return {
const defaultConfigForNoPermission = {
text: i18n.baseText('workflows.publish'),
enabled: false,
showIndicator: false,
@@ -158,6 +158,17 @@ const publishButtonConfig = computed(() => {
tooltip: i18n.baseText('workflows.publish.permissionDenied'),
showVersionInfo: false,
};
const isWorkflowPublished = !!workflowsStore.workflow.activeVersion;
if (isWorkflowPublished) {
return {
...defaultConfigForNoPermission,
showIndicator: true,
showVersionInfo: true,
indicatorClass: 'published',
};
} else {
return defaultConfigForNoPermission;
}
}
// Handle new workflow state
@@ -288,7 +299,7 @@ defineExpose({
{{ publishButtonConfig.tooltip }} <br />
</template>
<template v-if="activeVersion && publishButtonConfig.showVersionInfo">
<span data-test-id="workflow-active-version-indicator">{{ activeVersionName }}</span
<span data-test-id="workflow-active-version-info">{{ activeVersionName }}</span
><br />{{ i18n.baseText('workflowHistory.item.active') }}
<TimeAgo v-if="latestPublishDate" :date="latestPublishDate" />
</template>
@@ -304,6 +315,7 @@ defineExpose({
<div :class="[$style.flex]">
<span
v-if="publishButtonConfig.showIndicator"
data-test-id="workflow-active-version-indicator"
:class="{
[$style.indicatorDot]: true,
[$style.indicatorPublished]: publishButtonConfig.indicatorClass === 'published',