mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Merge pull request #3074 from woocommerce/PCP-4195-things-to-do-reset-the-dismissed-items-on-disconnect
Things To Do: Reset todos on disconnect (4195)
This commit is contained in:
commit
592e9cb50c
2 changed files with 16 additions and 0 deletions
|
@ -79,6 +79,14 @@ class TodosModel extends AbstractDataModel {
|
|||
$this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets completed onclick todos.
|
||||
*/
|
||||
public function reset_completed_onclick_todos(): void {
|
||||
$this->data['completedOnClickTodos'] = array();
|
||||
$this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets current todos data including dismissed and completed states.
|
||||
*
|
||||
|
|
|
@ -23,6 +23,7 @@ use WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods\P24Gateway;
|
|||
use WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods\TrustlyGateway;
|
||||
use WooCommerce\PayPalCommerce\Settings\Ajax\SwitchSettingsUiEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Settings\Data\OnboardingProfile;
|
||||
use WooCommerce\PayPalCommerce\Settings\Data\TodosModel;
|
||||
use WooCommerce\PayPalCommerce\Settings\Endpoint\RestEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Settings\Handler\ConnectionListener;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
|
@ -263,12 +264,19 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
|||
add_action(
|
||||
'woocommerce_paypal_payments_merchant_disconnected',
|
||||
static function () use ( $container ) : void {
|
||||
// Reset onboarding profile.
|
||||
$onboarding_profile = $container->get( 'settings.data.onboarding' );
|
||||
assert( $onboarding_profile instanceof OnboardingProfile );
|
||||
|
||||
$onboarding_profile->set_completed( false );
|
||||
$onboarding_profile->set_step( 0 );
|
||||
$onboarding_profile->save();
|
||||
|
||||
// Reset dismissed and completed on click todos.
|
||||
$todos = $container->get( 'settings.data.todos' );
|
||||
assert( $todos instanceof TodosModel );
|
||||
$todos->reset_dismissed_todos();
|
||||
$todos->reset_completed_onclick_todos();
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue