diff --git a/projects/plugins/jetpack/changelog/subscription-block-social-toggle b/projects/plugins/jetpack/changelog/subscription-block-social-toggle
new file mode 100644
index 0000000000000..00595e7fd265e
--- /dev/null
+++ b/projects/plugins/jetpack/changelog/subscription-block-social-toggle
@@ -0,0 +1,4 @@
+Significance: patch
+Type: bugfix
+
+Don't show "Include social followers in count" when showSubscribersTotal is not toggled or isPublicizeEnabled is false
diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/controls.js b/projects/plugins/jetpack/extensions/blocks/subscriptions/controls.js
index 78a431a2e6ee0..d8e41cf4a6fb8 100644
--- a/projects/plugins/jetpack/extensions/blocks/subscriptions/controls.js
+++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/controls.js
@@ -1,4 +1,5 @@
import { numberFormat } from '@automattic/jetpack-components';
+import { usePublicizeConfig } from '@automattic/jetpack-publicize-components';
import { isSimpleSite } from '@automattic/jetpack-shared-extension-utils';
import {
ContrastChecker,
@@ -54,6 +55,8 @@ export default function SubscriptionControls( {
buttonWidth,
successMessage,
} ) {
+ const { isPublicizeEnabled } = usePublicizeConfig();
+
return (
<>
{ isNewsletterFeatureEnabled() && }
@@ -240,14 +243,17 @@ export default function SubscriptionControls( {
}
} }
/>
- {
- setAttributes( { includeSocialFollowers: ! includeSocialFollowers } );
- } }
- />
+ { showSubscribersTotal && isPublicizeEnabled ? (
+ {
+ setAttributes( { includeSocialFollowers: ! includeSocialFollowers } );
+ } }
+ />
+ ) : null }
+
{
};
} );
+jest.mock( '@wordpress/notices', () => {}, { virtual: true } );
+
const setButtonBackgroundColor = jest.fn();
const setGradient = jest.fn();
const setTextColor = jest.fn();
diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/test/edit.js b/projects/plugins/jetpack/extensions/blocks/subscriptions/test/edit.js
index 271ecd860d8d1..cf97ea9ce801a 100644
--- a/projects/plugins/jetpack/extensions/blocks/subscriptions/test/edit.js
+++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/test/edit.js
@@ -54,6 +54,8 @@ jest.mock( '@wordpress/block-editor', () => ( {
} ),
} ) );
+jest.mock( '@wordpress/notices', () => {}, { virtual: true } );
+
describe( 'SubscriptionEdit', () => {
test( 'adds correct classes to container', async () => {
const { container } = render( );
diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/test/validate.js b/projects/plugins/jetpack/extensions/blocks/subscriptions/test/validate.js
index 88e752617cd9b..7b6318f8c01cb 100644
--- a/projects/plugins/jetpack/extensions/blocks/subscriptions/test/validate.js
+++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/test/validate.js
@@ -5,4 +5,6 @@ import runBlockFixtureTests from '../../../shared/test/block-fixtures';
// The main block should be the first in the array.
const blocks = [ { name: `jetpack/${ name }`, settings } ];
+jest.mock( '@wordpress/notices', () => {}, { virtual: true } );
+
runBlockFixtureTests( `jetpack/${ name }`, blocks, __dirname );
diff --git a/projects/plugins/jetpack/tests/jest.config.extensions.js b/projects/plugins/jetpack/tests/jest.config.extensions.js
index b9a0b0f5a5509..8fc400e7fe9bd 100644
--- a/projects/plugins/jetpack/tests/jest.config.extensions.js
+++ b/projects/plugins/jetpack/tests/jest.config.extensions.js
@@ -8,4 +8,8 @@ module.exports = {
...baseConfig.testPathIgnorePatterns,
'extensions/shared/test/block-fixtures.js',
],
+ moduleNameMapper: {
+ ...baseConfig.moduleNameMapper,
+ '\\.(css|less|sass|scss)$': '/tests/styles-mock.js',
+ },
};
diff --git a/projects/plugins/jetpack/tests/styles-mock.js b/projects/plugins/jetpack/tests/styles-mock.js
new file mode 100644
index 0000000000000..f053ebf7976e3
--- /dev/null
+++ b/projects/plugins/jetpack/tests/styles-mock.js
@@ -0,0 +1 @@
+module.exports = {};