-
Notifications
You must be signed in to change notification settings - Fork 50
Add category support to client package #114
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #114 +/- ##
============================================
+ Coverage 86.48% 86.65% +0.17%
Complexity 148 148
============================================
Files 18 18
Lines 969 982 +13
Branches 86 92 +6
============================================
+ Hits 838 851 +13
Misses 131 131
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
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. |
951d33c to
80100bf
Compare
gziolo
left a comment
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.
@emdashcodes, everything looks great from my perspective. This bring the client and server implementation closer to each other after the mandatory category got introduced. As noted in the feedback, @galatanovidiu is working in #115 on adding filtering capabilities on the server, so I added a commit to account on the same shape on the client. This way we should have the interfaces open for further extension with not risk of backward incompatibilities.
I'm approving this PR, but since I added new commits that change some code paths substantially, I would appreciate some sanity check.
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.
Your two changes look good to me. I did some testing on it this morning as well. Thanks for handling it!
This PR adds some basic category registration and filtering functionality to the
@wordpress/abilitiesclient package, allowing developers to filter abilities by category through the JavaScript API. This addresses some of the feedback highlighted in #102 (review).What's Changed
category: stringfield to theAbilityinterface and storegetAbilities()API function to accept an optionalcategoryparameter throughargsobjectTests
Documentation updates
registerAbilitydocumentationNot Addressed in this PR
Testing Instructions
npm run test:clientmeta.show_in_resttotrueFor example, I have some server and client abilities, and I can filter by navigation: