Add missing woocommerce_run_on_woocommerce_admin_updated hook for RemoteInboxNotificationsEngine scheduled action (#38159)

* Remove maybe_mark_complete usage

* Add changelog

* Add woocommerce_run_on_woocommerce_admin_updated hook

* Add changelog

* Fix lint
This commit is contained in:
Chi-Hsuan Huang 2023-05-09 18:53:08 +08:00 committed by GitHub
parent 059d1de563
commit 4c9bcbc30e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Add missing woocommerce_run_on_woocommerce_admin_updated hook for the scheduled action registered in RemoteInboxNotificationsEngine

View File

@ -40,19 +40,20 @@ class RemoteInboxNotificationsEngine {
// Hook into WCA updated. This is hooked up here rather than in
// on_admin_init because that runs too late to hook into the action.
add_action( 'woocommerce_run_on_woocommerce_admin_updated', array( __CLASS__, 'run_on_woocommerce_admin_updated' ) );
add_action(
'woocommerce_updated',
function() {
$next_hook = WC()->queue()->get_next(
'woocommerce_run_on_woocommerce_admin_updated',
array( __CLASS__, 'run_on_woocommerce_admin_updated' ),
array(),
'woocommerce-remote-inbox-engine'
);
if ( null === $next_hook ) {
WC()->queue()->schedule_single(
time(),
'woocommerce_run_on_woocommerce_admin_updated',
array( __CLASS__, 'run_on_woocommerce_admin_updated' ),
array(),
'woocommerce-remote-inbox-engine'
);
}