-
Couldn't load subscription status.
- Fork 72
Fix PHP Deprecated: Hook woocommerce_rest_api_option_permissions #10636
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
Fix PHP Deprecated: Hook woocommerce_rest_api_option_permissions #10636
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
|
Size Change: +244 B (0%) Total Size: 1.27 MB
ℹ️ View Unchanged
|
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.
The approach looks great! 😍
I actually like that we have a specific controller for this, rather than extending controllers from core that might or might not be meant for our needs.
includes/admin/class-wc-rest-payments-settings-option-controller.php
Outdated
Show resolved
Hide resolved
includes/admin/class-wc-rest-payments-settings-option-controller.php
Outdated
Show resolved
Hide resolved
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.
Thanks for working on this Dat! I left one inline comment for an option that was removed by another PR today. So we can remove that one.
includes/admin/class-wc-rest-payments-settings-option-controller.php
Outdated
Show resolved
Hide resolved
…option_permissions
- Change from option_key to option_name
…option_permissions
…option_permissions
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.
The changes look excellent!
Of course, I could not test all individual options, but the code changes make sense. I only tested the new Fraud Protection tools on a Jurassic Ninja site, and it worked as expected.
Maybe a second set of eyes (looking at you @allie500 🤣) would be a great sanity check. Otherwise ![]()
includes/admin/class-wc-rest-payments-settings-option-controller.php
Outdated
Show resolved
Hide resolved
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.
Thanks for the comprehensive fix! I left some nitpicks regarding use of await. There's also an unused import of useDispatch on line 9 in client/overview/modal/progressive-onboarding-eligibility/index.tsx that we can remove.
I tested the wcpay_fraud_protection_welcome_tour_dismissed flow and it worked as expected.
Aside from the await and unused import nitpicks, I'm approving the PR.
![]()
| await updateOptions( { | ||
| wcpay_connection_success_modal_dismissed: true, | ||
| } ); | ||
| await saveOption( 'wcpay_connection_success_modal_dismissed', true ); |
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.
Nitpick: We can remove await here.
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.
Addressed ecbdedc
…option_permissions
Fixes #7864
TODOs:
Changes proposed in this Pull Request
/wp-json/wc/v3/payments/settings/{option_key}saveOptionin JS code so that we can send the direct REST API request to the endpoint above. This will replaceupdateOptionsprovided by Woo core, which uses the Woo core Options REST API.Testing instructions
npm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge