diff --git a/projects/plugins/jetpack/changelog/fix-wpcomsh-activity-log-default-on b/projects/plugins/jetpack/changelog/fix-wpcomsh-activity-log-default-on new file mode 100644 index 000000000000..8bb963cb3324 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-wpcomsh-activity-log-default-on @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Test bootstrap only: ignore a wpcomsh module policy in the wpcomsh test run. + + diff --git a/projects/plugins/jetpack/tests/php/bootstrap.php b/projects/plugins/jetpack/tests/php/bootstrap.php index 0a69b17668a1..d56da3e8a692 100644 --- a/projects/plugins/jetpack/tests/php/bootstrap.php +++ b/projects/plugins/jetpack/tests/php/bootstrap.php @@ -180,6 +180,9 @@ function _manually_load_muplugin() { require_once JETPACK_WPCOMSH_INSTALL_DIR . '/wpcomsh.php'; \Automattic\Jetpack\Jetpack_Mu_Wpcom::init(); + // Module-state tests assume self-hosted defaults, which this policy overrides. + remove_filter( 'jetpack_feature_policy', 'wpcomsh_force_activity_log_module' ); + defined( 'WPCOMSH_PREMIUM_THEMES_PATH' ) || define( 'WPCOMSH_PREMIUM_THEMES_PATH', sys_get_temp_dir() . '/premium' ); if ( ! is_dir( WPCOMSH_PREMIUM_THEMES_PATH ) ) { mkdir( WPCOMSH_PREMIUM_THEMES_PATH, 0777 ); diff --git a/projects/plugins/wpcomsh/changelog/fix-wpcomsh-activity-log-default-on b/projects/plugins/wpcomsh/changelog/fix-wpcomsh-activity-log-default-on new file mode 100644 index 000000000000..aa95eb609517 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/fix-wpcomsh-activity-log-default-on @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Activity Log: Keep the Activity Log on for all sites, including newly transferred and reset ones. diff --git a/projects/plugins/wpcomsh/feature-plugins/activity-log.php b/projects/plugins/wpcomsh/feature-plugins/activity-log.php new file mode 100644 index 000000000000..1b7f2ec29cf5 --- /dev/null +++ b/projects/plugins/wpcomsh/feature-plugins/activity-log.php @@ -0,0 +1,29 @@ + 'forced-on' ); + + return $policy; +} +add_filter( 'jetpack_feature_policy', 'wpcomsh_force_activity_log_module' ); diff --git a/projects/plugins/wpcomsh/tests/ActivityLogTest.php b/projects/plugins/wpcomsh/tests/ActivityLogTest.php new file mode 100644 index 000000000000..06ccc77984cd --- /dev/null +++ b/projects/plugins/wpcomsh/tests/ActivityLogTest.php @@ -0,0 +1,50 @@ + array( 'activation' => 'forced-on' ) ); + $expected = $forced + ? array_merge( $existing, array( 'activity-log' => array( 'activation' => 'forced-on' ) ) ) + : $existing; + + $this->assertSame( $expected, wpcomsh_force_activity_log_module( $existing, $jetpack_version ) ); + } + + /** + * Data provider for test_forces_module_on_only_when_jetpack_ships_it. + * + * @return array + */ + public static function version_provider() { + return array( + 'before the module' => array( '16.2', false ), + 'prerelease build' => array( '16.3-beta', true ), + 'release' => array( '16.3', true ), + ); + } +} diff --git a/projects/plugins/wpcomsh/woa.php b/projects/plugins/wpcomsh/woa.php index cf38f963ff57..d62396090c82 100644 --- a/projects/plugins/wpcomsh/woa.php +++ b/projects/plugins/wpcomsh/woa.php @@ -442,7 +442,7 @@ function wpcomsh_woa_post_process_store_woocommerce_connection_details( $args, $ /** * Ensures that specific Jetpack modules are activated after a transfer. - * Addresses the issue where certain modules like blocks, account-protection, blaze, and wpcom-reader + * Addresses the issue where certain modules like blocks, account-protection, activity-log, blaze, and wpcom-reader * may be disabled during the transfer process. * * @param array $args Arguments. @@ -460,6 +460,7 @@ function wpcomsh_woa_post_process_activate_jetpack_modules( $args, $assoc_args ) $modules_to_activate = array( 'account-protection', + 'activity-log', 'blaze', 'blocks', 'wpcom-reader', diff --git a/projects/plugins/wpcomsh/wpcomsh.php b/projects/plugins/wpcomsh/wpcomsh.php index 5d73cda1e38d..061dfb194c97 100644 --- a/projects/plugins/wpcomsh/wpcomsh.php +++ b/projects/plugins/wpcomsh/wpcomsh.php @@ -131,6 +131,7 @@ function () { require_once __DIR__ . '/endpoints/rest-api.php'; // Load feature plugins. +require_once __DIR__ . '/feature-plugins/activity-log.php'; require_once __DIR__ . '/feature-plugins/activitypub.php'; require_once __DIR__ . '/feature-plugins/additional-css.php'; require_once __DIR__ . '/feature-plugins/ai-launchpad.php';