Skip to content

Commit

Permalink
Navigation Submenu: Remove user permission checks (#63720)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Jul 19, 2024
1 parent ef198f9 commit dc41a6e
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions packages/block-library/src/navigation-submenu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
import { isURL, prependHTTP } from '@wordpress/url';
import { useState, useEffect, useRef } from '@wordpress/element';
import { link as linkIcon, removeSubmenu } from '@wordpress/icons';
import { useResourcePermissions } from '@wordpress/core-data';
import { speak } from '@wordpress/a11y';
import { createBlock } from '@wordpress/blocks';
import { useMergeRefs, usePrevious } from '@wordpress/compose';
Expand Down Expand Up @@ -134,7 +133,7 @@ export default function NavigationSubmenuEdit( {
context,
clientId,
} ) {
const { label, type, url, description, rel, title } = attributes;
const { label, url, description, rel, title } = attributes;

const { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;

Expand All @@ -154,9 +153,6 @@ export default function NavigationSubmenuEdit( {
const itemLabelPlaceholder = __( 'Add text…' );
const ref = useRef();

const pagesPermissions = useResourcePermissions( 'pages' );
const postsPermissions = useResourcePermissions( 'posts' );

const {
parentCount,
isParentOfSelectedBlock,
Expand Down Expand Up @@ -264,13 +260,6 @@ export default function NavigationSubmenuEdit( {
selection.addRange( range );
}

let userCanCreate = false;
if ( ! type || type === 'page' ) {
userCanCreate = pagesPermissions.canCreate;
} else if ( type === 'post' ) {
userCanCreate = postsPermissions.canCreate;
}

const {
textColor,
customTextColor,
Expand Down Expand Up @@ -499,7 +488,6 @@ export default function NavigationSubmenuEdit( {
}
} }
anchor={ popoverAnchor }
hasCreateSuggestion={ userCanCreate }
onRemove={ () => {
setAttributes( { url: '' } );
speak( __( 'Link removed.' ), 'assertive' );
Expand Down

1 comment on commit dc41a6e

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in dc41a6e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10003318895
📝 Reported issues:

Please sign in to comment.