Skip to content

Commit

Permalink
Navigation Submenu: Remove user permission checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Jul 18, 2024
1 parent 0a7e10d commit 0cc58cc
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

0 comments on commit 0cc58cc

Please sign in to comment.