You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #36286 we learnt the Nav block provides a very poor UX for users with lower permissions.
The block should be readable but not writeable/editable.
This PR seeks to address that by:
Disabling the entire block UI but allowing it to remain visible.
Removing all block specific controls
Adding a warning notice below the block indicating a lack of permissions is why the block isn't editable.
Currently this uses a constant variable to indicate whether the user has suitable permissions. We will need to replace that with a call to canUser() and ensure the wp_navigation post type is configured with the correct perms.
I've tested my changes with keyboard and screen readers.
My code has proper inline documentation.
I've included developer documentation if appropriate.
I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
FYI canUser('create', 'wp_navigation') is always false because it expects an allow header to be returned from the REST API endpoint v2/navigations using an OPTIONS request. Currently that doesn't happen.
If you do canUser('create', 'posts') it works perfectly and the header is there. No idea why.
FYI canUser('create', 'wp_navigation') is always false because it expects an allow header to be returned from the REST API endpoint v2/navigations using an OPTIONS request. Currently that doesn't happen.
@getdave This call is incorrect. It should be canUser('create', 'navigation').The second param, is the slug used in the REST API not the key name for the post type. The rest url url is wp/v2/navigation and not wp/v2/wp_navigation
FYI canUser('create', 'wp_navigation') is always false because it expects an allow header to be returned from the REST API endpoint v2/navigations using an OPTIONS request. Currently that doesn't happen.
@getdave This call is incorrect. It should be canUser('create', 'navigation').The second param, is the slug used in the REST API not the key name for the post type. The rest url url is wp/v2/navigation and not wp/v2/wp_navigation
Yeh I ended up figuring this one out via debugging the code. Thanks for clarifying though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In #36286 we learnt the Nav block provides a very poor UX for users with lower permissions.
The block should be readable but not writeable/editable.
This PR seeks to address that by:
Currently this uses a constant variable to indicate whether the user has suitable permissions. We will need to replace that with a call to
canUser()and ensure thewp_navigationpost type is configured with the correct perms.Addresses part of #36286
How has this been tested?
Screenshots
Types of changes
Checklist:
*.native.jsfiles for terms that need renaming or removal).