Skip to content

Commit

Permalink
Update/vaultpress backup card purchased state (#33927)
Browse files Browse the repository at this point in the history
* Add undo button and activity log

* changelog

* Update lockfiles

* changelog

* Fix type declaration

* Check backup capabilities

* Update projects/packages/my-jetpack/_inc/components/product-cards-section/backup-card/index.jsx

Co-authored-by: Bryan Elliott <bryan@elliottprogrammer.com>

* Fix undo url

* Update project version

---------

Co-authored-by: Bryan Elliott <bryan@elliottprogrammer.com>

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/6749603662
  • Loading branch information
CodeyGuyDylan authored and matticbot committed Nov 3, 2023
1 parent b127eda commit 14fa1a4
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.59.0-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Added
- Add a method to check if Jetpack is ready for uninstall cleanup.

## [1.58.3] - 2023-11-03
### Fixed
- Make sure scheme history option is an array. [#33905]
Expand Down Expand Up @@ -900,6 +907,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Separate the connection library into its own package.

[1.59.0-alpha]: https://github.com/Automattic/jetpack-connection/compare/v1.58.3...v1.59.0-alpha
[1.58.3]: https://github.com/Automattic/jetpack-connection/compare/v1.58.2...v1.58.3
[1.58.2]: https://github.com/Automattic/jetpack-connection/compare/v1.58.1...v1.58.2
[1.58.1]: https://github.com/Automattic/jetpack-connection/compare/v1.58.0...v1.58.1
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "1.58.x-dev"
"dev-trunk": "1.59.x-dev"
}
},
"config": {
Expand Down
14 changes: 14 additions & 0 deletions src/class-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2558,4 +2558,18 @@ public static function get_site_id() {
}
return (int) $site_id;
}

/**
* Check if Jetpack is ready for uninstall cleanup.
*
* @param string $current_plugin_slug The current plugin's slug.
*
* @return bool
*/
public static function is_ready_for_cleanup( $current_plugin_slug ) {
$active_plugins = get_option( Plugin_Storage::ACTIVE_PLUGINS_OPTION_NAME );

return empty( $active_plugins ) || ! is_array( $active_plugins )
|| ( count( $active_plugins ) === 1 && array_key_exists( $current_plugin_slug, $active_plugins ) );
}
}
2 changes: 1 addition & 1 deletion src/class-package-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '1.58.3';
const PACKAGE_VERSION = '1.59.0-alpha';

const PACKAGE_SLUG = 'connection';

Expand Down
42 changes: 42 additions & 0 deletions tests/php/test_Manager_unit.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,4 +643,46 @@ public function test_disconnect_site_will_remove_tracked_package_versions() {
public function filter_api_constant( $value, $name ) {
return constant( __NAMESPACE__ . "\Utils::DEFAULT_$name" );
}

/**
* Test the `is_ready_for_cleanup()` method with the negative result (has other connected plugins).
*
* @return void
*/
public function test_is_ready_for_cleanup_no() {
$option_filter = function () {
return array(
'jetpack-backup' => array(
'name' => 'Jetpack Backup',
),
);
};

add_filter( 'pre_option_jetpack_connection_active_plugins', $option_filter );
$is_ready = Manager::is_ready_for_cleanup( 'jetpack' );
remove_filter( 'pre_option_jetpack_connection_active_plugins', $option_filter );

$this->assertFalse( $is_ready );
}

/**
* Test the `is_ready_for_cleanup()` method with the positive result (no other connected plugins).
*
* @return void
*/
public function test_is_ready_for_cleanup_yes() {
$option_filter = function () {
return array(
'jetpack' => array(
'name' => 'Jetpack',
),
);
};

add_filter( 'pre_option_jetpack_connection_active_plugins', $option_filter );
$is_ready = Manager::is_ready_for_cleanup( 'jetpack' );
remove_filter( 'pre_option_jetpack_connection_active_plugins', $option_filter );

$this->assertTrue( $is_ready );
}
}

0 comments on commit 14fa1a4

Please sign in to comment.