diff --git a/projects/packages/jetpack-mu-wpcom/changelog/update-subscribe-modal-filters b/projects/packages/jetpack-mu-wpcom/changelog/update-subscribe-modal-filters new file mode 100644 index 0000000000000..7a5088893edd9 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/update-subscribe-modal-filters @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Always enable subscribe modal task in launchpad. diff --git a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php index da41d9f0b1024..cc47f9ac65a41 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php @@ -427,7 +427,6 @@ function wpcom_launchpad_get_task_definitions() { return __( 'Enable subscribers modal', 'jetpack-mu-wpcom' ); }, 'is_complete_callback' => 'wpcom_launchpad_is_task_option_completed', - 'is_visible_callback' => 'wpcom_launchpad_is_enable_subscribers_modal_visible', 'get_calypso_path' => function ( $task, $default, $data ) { return '/settings/newsletter/' . $data['site_slug_encoded']; }, @@ -1370,15 +1369,6 @@ function wpcom_launchpad_mark_enable_subscribers_modal_complete( $old_value, $va add_action( 'update_option_sm_enabled', 'wpcom_launchpad_mark_enable_subscribers_modal_complete', 10, 3 ); add_action( 'add_option_sm_enabled', 'wpcom_launchpad_mark_enable_subscribers_modal_complete', 10, 3 ); -/** - * Determines whether the enable_subscribers_modal task should show. - * - * @return bool True if the task should show, false otherwise. - */ -function wpcom_launchpad_is_enable_subscribers_modal_visible() { - return apply_filters( 'jetpack_subscriptions_modal_enabled', false ); -} - /** * Determine `domain_claim` task visibility. * diff --git a/projects/plugins/jetpack/_inc/client/newsletter/subscriptions-settings.jsx b/projects/plugins/jetpack/_inc/client/newsletter/subscriptions-settings.jsx index 15489302768a3..bb0f8da0c4f29 100644 --- a/projects/plugins/jetpack/_inc/client/newsletter/subscriptions-settings.jsx +++ b/projects/plugins/jetpack/_inc/client/newsletter/subscriptions-settings.jsx @@ -14,7 +14,6 @@ import React, { useCallback } from 'react'; import { connect } from 'react-redux'; import { isCurrentUserLinked, isUnavailableInOfflineMode, isOfflineMode } from 'state/connection'; import { - isSubscriptionModalEnabled, currentThemeIsBlockTheme, currentThemeStylesheet, getSiteAdminUrl, @@ -33,7 +32,6 @@ const trackViewSubsClick = () => { */ function SubscriptionsSettings( props ) { const { - hasSubscriptionModal, unavailableInOfflineMode, isLinked, isOffline, @@ -149,36 +147,32 @@ function SubscriptionsSettings( props ) { 'jetpack' ) } /> - { hasSubscriptionModal && ( - <> - -

- { __( - 'Automatically add a subscribe form pop-up to every post and turn visitors into subscribers. It will appear as readers scroll through your posts.', - 'jetpack' - ) } - { isBlockTheme && subscribeModalEditorUrl && ( - <> - { ' ' } - - { __( 'Preview and edit the pop-up', 'jetpack' ) } - - - ) } -

- - ) } + +

+ { __( + 'Automatically add a subscribe form pop-up to every post and turn visitors into subscribers. It will appear as readers scroll through your posts.', + 'jetpack' + ) } + { isBlockTheme && subscribeModalEditorUrl && ( + <> + { ' ' } + + { __( 'Preview and edit the pop-up', 'jetpack' ) } + + + ) } +

} @@ -201,7 +195,6 @@ export default withModuleSettingsFormHelpers( isLinked: isCurrentUserLinked( state ), isOffline: isOfflineMode( state ), isSubscriptionsActive: ownProps.getOptionValue( 'subscriptions' ), - hasSubscriptionModal: isSubscriptionModalEnabled( state ), unavailableInOfflineMode: isUnavailableInOfflineMode( state, 'subscriptions' ), subscriptions: getModule( state, 'subscriptions' ), isStbEnabled: ownProps.getOptionValue( 'stb_enabled' ), diff --git a/projects/plugins/jetpack/_inc/client/state/initial-state/reducer.js b/projects/plugins/jetpack/_inc/client/state/initial-state/reducer.js index 3beccc160ddfc..62c7ccf2c8f88 100644 --- a/projects/plugins/jetpack/_inc/client/state/initial-state/reducer.js +++ b/projects/plugins/jetpack/_inc/client/state/initial-state/reducer.js @@ -700,16 +700,6 @@ export function isBlazeDashboardEnabled( state ) { return !! state.jetpack.initialState.isBlazeDashboardEnabled; } -/** - * Returns true if Subscribe Modal can be used on the site. - * - * @param {object} state - Global state tree. - * @returns {boolean} True if Subscription Modal is available on the site. - */ -export function isSubscriptionModalEnabled( state ) { - return !! state.jetpack.initialState.isSubscriptionModalEnabled; -} - /** * Returns true if Jetpack's Pre-connection helpers are enabled. * diff --git a/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php b/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php index 17b72d5a49cc9..57e847f950e50 100644 --- a/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php +++ b/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php @@ -238,8 +238,6 @@ public static function get_initial_state() { 'isOdysseyStatsEnabled' => Stats_Options::get_option( 'enable_odyssey_stats' ), 'shouldInitializeBlaze' => Blaze::should_initialize(), 'isBlazeDashboardEnabled' => Blaze::is_dashboard_enabled(), - /** This filter is documented in plugins/jetpack/modules/subscriptions/subscribe-module/class-jetpack-subscribe-module.php */ - 'isSubscriptionModalEnabled' => apply_filters( 'jetpack_subscriptions_modal_enabled', false ), 'socialInitialState' => self::get_publicize_initial_state(), 'gutenbergInitialState' => self::get_gutenberg_initial_state(), ); diff --git a/projects/plugins/jetpack/changelog/update-subscribe-modal-filters b/projects/plugins/jetpack/changelog/update-subscribe-modal-filters new file mode 100644 index 0000000000000..4315d884e3508 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-subscribe-modal-filters @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +Add subscribe modal to Newsletter settings diff --git a/projects/plugins/jetpack/modules/subscriptions.php b/projects/plugins/jetpack/modules/subscriptions.php index c863855bef1cf..bcca522603a7f 100644 --- a/projects/plugins/jetpack/modules/subscriptions.php +++ b/projects/plugins/jetpack/modules/subscriptions.php @@ -360,21 +360,18 @@ public function configure() { /** Enable Subscribe Modal */ - /** This filter is documented in plugins/jetpack/modules/subscriptions/subscribe-module/class-jetpack-subscribe-module.php */ - if ( apply_filters( 'jetpack_subscriptions_modal_enabled', false ) ) { - add_settings_field( - 'jetpack_subscriptions_comment_subscribe', - __( 'Enable Subscribe Modal', 'jetpack' ), - array( $this, 'subscribe_modal_setting' ), - 'discussion', - 'jetpack_subscriptions' - ); + add_settings_field( + 'jetpack_subscriptions_comment_subscribe', + __( 'Enable Subscribe Modal', 'jetpack' ), + array( $this, 'subscribe_modal_setting' ), + 'discussion', + 'jetpack_subscriptions' + ); - register_setting( - 'discussion', - 'sm_enabled' - ); - } + register_setting( + 'discussion', + 'sm_enabled' + ); /** Email me whenever: Someone follows my blog */ /* @since 8.1 */ diff --git a/projects/plugins/jetpack/tests/php/modules/subscriptions/test_class.jetpack-subscribe-modal.php b/projects/plugins/jetpack/tests/php/modules/subscriptions/test_class.jetpack-subscribe-modal.php deleted file mode 100644 index 09218030bb307..0000000000000 --- a/projects/plugins/jetpack/tests/php/modules/subscriptions/test_class.jetpack-subscribe-modal.php +++ /dev/null @@ -1,64 +0,0 @@ -assertFalse( apply_filters( 'jetpack_subscriptions_modal_enabled', false ) ); - - // Test that the modal is not enabled even when - // other needed conditions are met. - switch_theme( 'block-theme' ); - update_option( 'site_intent', 'newsletter' ); - $this->assertFalse( apply_filters( 'jetpack_subscriptions_modal_enabled', false ) ); - - // Test that feature can be enabled by manually adding - // feature flag filter. - add_filter( 'jetpack_subscriptions_modal_enabled', '__return_true', 11 ); - $this->assertTrue( apply_filters( 'jetpack_subscriptions_modal_enabled', false ) ); - } -} diff --git a/projects/plugins/mu-wpcom-plugin/changelog/update-subscribe-modal-filters b/projects/plugins/mu-wpcom-plugin/changelog/update-subscribe-modal-filters new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/mu-wpcom-plugin/changelog/update-subscribe-modal-filters @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + +