mirror of
https://github.com/strapi/strapi.git
synced 2025-11-07 13:55:20 +00:00
Fix: bulk publish modified entry status (#20399)
* fix: updated publication status for modified entry * fix: handled modified entry to unpublish bulk action along with bulk publish
This commit is contained in:
parent
c579e0b62b
commit
08850ba05e
@ -385,7 +385,7 @@ const UnpublishAction: BulkActionComponent = ({ documents, model }) => {
|
|||||||
const showUnpublishButton =
|
const showUnpublishButton =
|
||||||
hasDraftAndPublishEnabled &&
|
hasDraftAndPublishEnabled &&
|
||||||
hasPublishPermission &&
|
hasPublishPermission &&
|
||||||
documents.some((entry) => entry.status === 'published');
|
documents.some((entry) => entry.status === 'published' || entry.status === 'modified');
|
||||||
|
|
||||||
if (!showUnpublishButton) return null;
|
if (!showUnpublishButton) return null;
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import {
|
|||||||
Loader,
|
Loader,
|
||||||
TypographyComponent,
|
TypographyComponent,
|
||||||
} from '@strapi/design-system';
|
} from '@strapi/design-system';
|
||||||
import { Pencil, CrossCircle, CheckCircle } from '@strapi/icons';
|
import { Pencil, CrossCircle, CheckCircle, ArrowsCounterClockwise } from '@strapi/icons';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
import { Link, useLocation } from 'react-router-dom';
|
import { Link, useLocation } from 'react-router-dom';
|
||||||
import { styled } from 'styled-components';
|
import { styled } from 'styled-components';
|
||||||
@ -80,13 +80,10 @@ const formatErrorMessages = (errors: FormErrors, parentKey: string, formatMessag
|
|||||||
|
|
||||||
interface EntryValidationTextProps {
|
interface EntryValidationTextProps {
|
||||||
validationErrors?: FormErrors;
|
validationErrors?: FormErrors;
|
||||||
isPublished?: boolean;
|
status: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EntryValidationText = ({
|
const EntryValidationText = ({ validationErrors, status }: EntryValidationTextProps) => {
|
||||||
validationErrors,
|
|
||||||
isPublished = false,
|
|
||||||
}: EntryValidationTextProps) => {
|
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
if (validationErrors) {
|
if (validationErrors) {
|
||||||
@ -106,7 +103,7 @@ const EntryValidationText = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPublished) {
|
if (status === 'published') {
|
||||||
return (
|
return (
|
||||||
<Flex gap={2}>
|
<Flex gap={2}>
|
||||||
<CheckCircle fill="success600" />
|
<CheckCircle fill="success600" />
|
||||||
@ -120,6 +117,20 @@ const EntryValidationText = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status === 'modified') {
|
||||||
|
return (
|
||||||
|
<Flex gap={2}>
|
||||||
|
<ArrowsCounterClockwise fill="alternative600" />
|
||||||
|
<Typography>
|
||||||
|
{formatMessage({
|
||||||
|
id: 'content-manager.bulk-publish.modified',
|
||||||
|
defaultMessage: 'Ready to publish changes',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex gap={2}>
|
<Flex gap={2}>
|
||||||
<CheckCircle fill="success600" />
|
<CheckCircle fill="success600" />
|
||||||
@ -208,7 +219,7 @@ const SelectedEntriesTableContent = ({
|
|||||||
) : (
|
) : (
|
||||||
<EntryValidationText
|
<EntryValidationText
|
||||||
validationErrors={validationErrors[row.documentId]}
|
validationErrors={validationErrors[row.documentId]}
|
||||||
isPublished={row.status === 'published'}
|
status={row.status}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
|
|||||||
@ -63,6 +63,7 @@
|
|||||||
"components.SettingsViewWrapper.pluginHeader.description.list-settings": "Define the settings of the list view.",
|
"components.SettingsViewWrapper.pluginHeader.description.list-settings": "Define the settings of the list view.",
|
||||||
"components.SettingsViewWrapper.pluginHeader.title": "Configure the view — {name}",
|
"components.SettingsViewWrapper.pluginHeader.title": "Configure the view — {name}",
|
||||||
"bulk-publish.already-published": "Already Published",
|
"bulk-publish.already-published": "Already Published",
|
||||||
|
"bulk-publish.modified": "Ready to publish changes",
|
||||||
"components.TableDelete.delete": "Delete all",
|
"components.TableDelete.delete": "Delete all",
|
||||||
"components.TableDelete.deleteSelected": "Delete selected",
|
"components.TableDelete.deleteSelected": "Delete selected",
|
||||||
"components.TableDelete.label": "{number, plural, one {# entry} other {# entries}} selected",
|
"components.TableDelete.label": "{number, plural, one {# entry} other {# entries}} selected",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user