From 40253bbec9bbca736b29fe7864bcc0806059c5a0 Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Wed, 9 Oct 2024 11:54:55 +0100 Subject: [PATCH 1/2] Fix isControlAllowed and isTemplate logic --- .../src/query/edit/inspector-controls/index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/block-library/src/query/edit/inspector-controls/index.js b/packages/block-library/src/query/edit/inspector-controls/index.js index 28a6113620fb7..e4e5702b3c575 100644 --- a/packages/block-library/src/query/edit/inspector-controls/index.js +++ b/packages/block-library/src/query/edit/inspector-controls/index.js @@ -123,21 +123,23 @@ export default function QueryInspectorControls( props ) { const showInheritControl = isTemplate && isControlAllowed( allowedControls, 'inherit' ); const showPostTypeControl = - ( ! inherit && isControlAllowed( allowedControls, 'postType' ) ) || - ! isTemplate; + ! inherit && + ! isTemplate && + isControlAllowed( allowedControls, 'postType' ); const postTypeControlLabel = __( 'Post type' ); const postTypeControlHelp = __( 'Select the type of content to display: posts, pages, or custom post types.' ); const showColumnsControl = false; const showOrderControl = - ( ! inherit && isControlAllowed( allowedControls, 'order' ) ) || - ! isTemplate; + ! inherit && + ! isTemplate && + isControlAllowed( allowedControls, 'order' ); const showStickyControl = - ( ! inherit && - showSticky && - isControlAllowed( allowedControls, 'sticky' ) ) || - ( showSticky && ! isTemplate ); + ! inherit && + ! isTemplate && + showSticky && + isControlAllowed( allowedControls, 'sticky' ); const showSettingsPanel = showInheritControl || showPostTypeControl || From 984e0d3968bf8264983a1769f1c652ed9947442f Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Wed, 9 Oct 2024 12:16:22 +0100 Subject: [PATCH 2/2] Remove isTemplate check when inherit is already being checked --- .../src/query/edit/inspector-controls/index.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/block-library/src/query/edit/inspector-controls/index.js b/packages/block-library/src/query/edit/inspector-controls/index.js index e4e5702b3c575..b373e0933fe71 100644 --- a/packages/block-library/src/query/edit/inspector-controls/index.js +++ b/packages/block-library/src/query/edit/inspector-controls/index.js @@ -123,21 +123,16 @@ export default function QueryInspectorControls( props ) { const showInheritControl = isTemplate && isControlAllowed( allowedControls, 'inherit' ); const showPostTypeControl = - ! inherit && - ! isTemplate && - isControlAllowed( allowedControls, 'postType' ); + ! inherit && isControlAllowed( allowedControls, 'postType' ); const postTypeControlLabel = __( 'Post type' ); const postTypeControlHelp = __( 'Select the type of content to display: posts, pages, or custom post types.' ); const showColumnsControl = false; const showOrderControl = - ! inherit && - ! isTemplate && - isControlAllowed( allowedControls, 'order' ); + ! inherit && isControlAllowed( allowedControls, 'order' ); const showStickyControl = ! inherit && - ! isTemplate && showSticky && isControlAllowed( allowedControls, 'sticky' ); const showSettingsPanel =