From c673833884f4844f00f9eb23cd84085dc4674752 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Tue, 17 Oct 2023 17:23:59 +1000 Subject: [PATCH] Use post type constants for patterns and parts --- .../src/hooks/commands/use-edit-mode-commands.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/edit-site/src/hooks/commands/use-edit-mode-commands.js b/packages/edit-site/src/hooks/commands/use-edit-mode-commands.js index b079c5e956121..0a066a5b6bc06 100644 --- a/packages/edit-site/src/hooks/commands/use-edit-mode-commands.js +++ b/packages/edit-site/src/hooks/commands/use-edit-mode-commands.js @@ -36,7 +36,12 @@ import { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal'; import { PATTERN_MODALS } from '../../components/pattern-modal'; import { TEMPLATE_PART_MODALS } from '../../components/template-part-modal'; import { unlock } from '../../lock-unlock'; -import { TEMPLATE_POST_TYPE, TEMPLATE_ORIGINS } from '../../utils/constants'; +import { + PATTERN_TYPES, + TEMPLATE_ORIGINS, + TEMPLATE_PART_POST_TYPE, + TEMPLATE_POST_TYPE, +} from '../../utils/constants'; const { useHistory } = unlock( routerPrivateApis ); @@ -372,7 +377,7 @@ function usePatternCommands() { const commands = []; - if ( record?.type === 'wp_block' ) { + if ( record?.type === PATTERN_TYPES.user ) { commands.push( { name: 'core/rename-pattern', label: __( 'Rename pattern' ), @@ -393,7 +398,7 @@ function usePatternCommands() { } ); } - if ( record?.type === 'wp_template_part' ) { + if ( record?.type === TEMPLATE_PART_POST_TYPE ) { if ( record?.source === TEMPLATE_ORIGINS.custom ) { commands.push( { name: 'core/rename-template-part',