-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Update Nav block permissions variable naming accuracy #59882
Conversation
Size Change: +2.44 kB (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Looks like e2e coverage pick up a regression here somewhere. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Flaky tests detected in 5fcf1e4. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8346020365
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks for this.
* Rename vars for increased clarity * Pluralise canCreate permission * Update tests * Improve comments * Fix resolver naming * Update tests Co-authored-by: getdave <[email protected]> Co-authored-by: scruffian <[email protected]>
What?
Improves the comprehension around the create/update/delete permissions used within the Nav block codebase.
Why?
The current code mixes the concepts of:
This is problematic when it comes to permissions because it is my understanding that:
create
permission is not related to any single Navigation Menu.update/delete
permission are only related to a single Navigation Menu Post.In the code however, the naming of the
canUser{Create|Update|Delete}NavigationMenu
makes is seem as though all 3 permissions are related to a single post.It's important that we distinguish that the
create
permission is plural and thus why I renamed the variable.How do I know this?
canUser
.OPTIONS
requests to the related endpoint for whatever resource (in our castnavigation
).Allow
header of the response to theOPTIONS
request.canUser
takes the result and maps it to the create/read/update/deleteThe
create
handler for the Navigation REST API endpoint doesn't require an ID. Therefore we know it's a permission that relates to all Navigation Menus rather than a specific one (like the way Update/Delete do require an ID).How?
Renames the variables to be clear what the permission relates to. It's a small change but it improves comprehension.
Longer term this will help us as we refactor towards using slugs are refs in the Nav block.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast