Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Loop: Fix isControlAllowed and isTemplate combined logic #65984

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,18 @@ export default function QueryInspectorControls( props ) {
const showInheritControl =
isTemplate && isControlAllowed( allowedControls, 'inherit' );
const showPostTypeControl =
( ! inherit && isControlAllowed( allowedControls, 'postType' ) ) ||
! isTemplate;
! inherit && isControlAllowed( allowedControls, 'postType' );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inherit is already being set to false if on singular content in query-conent.js, so we can remove the isTemplate check from these lines.

The only isTemplate check we need here is the one on line 124, as this decides whether to show the inherit control or not, and the intended behaviour is for this control to only show when on non-singular content (and if the control is allowed).

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 && isControlAllowed( allowedControls, 'order' );
const showStickyControl =
( ! inherit &&
showSticky &&
isControlAllowed( allowedControls, 'sticky' ) ) ||
( showSticky && ! isTemplate );
! inherit &&
showSticky &&
isControlAllowed( allowedControls, 'sticky' );
const showSettingsPanel =
showInheritControl ||
showPostTypeControl ||
Expand Down
Loading