Skip to content

Comments: update settings menu - #53538

Open
arcangelini wants to merge 21 commits into
trunkfrom
update/comments-settings-screen
Open

arcangelini wants to merge 21 commits into
trunkfrom
update/comments-settings-screen

Conversation

@arcangelini

@arcangelini arcangelini commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Fixes #

Proposed changes

  • Add two settings to the Comments card in Jetpack > Settings > Discussion: "Allow images from links" and "Allow embeds from YouTube, X, and other services". They show where the new Jetpack Comments form is on, and are disabled while the module is off.
  • Store them as jetpack_comments_images and jetpack_comments_embeds, both on by default. The jetpack_comments_block_editor_images and jetpack_comments_block_editor_embeds filters still override them. Both are registered in the settings endpoint and added to the Sync options list.
  • Remove the setting to turn off blocks in comments, from this card and from Settings > Discussion in wp-admin. With Jetpack Comments on, readers always get the block editor, unless the jetpack_comments_block_editor filter turns it off.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • On a connected Jetpack site with the new Jetpack Comments form, go to Jetpack > Settings > Discussion.
  • With the Comments module off, the image and embed toggles are disabled. Turn it on.
  • Turn off "Allow images from links", save, then paste an image URL into a comment. It posts as a link, not an image. Do the same for embeds with a YouTube URL.
  • Reload and confirm both settings stuck.
  • In Settings > Discussion in wp-admin, the "Allow Blocks" setting is gone.

🤖 Generated with Claude Code

@arcangelini arcangelini added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress labels Oct 13, 2026
@arcangelini arcangelini self-assigned this Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the update/comments-settings-screen branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/comments-settings-screen
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/comments-settings-screen

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Feature] Comments [Package] Comments [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh Admin Page React-powered dashboard under the Jetpack menu labels Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 8, 2026
    • Code freeze: December 7, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Mu Wpcom plugin:

  • Next scheduled release: WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Classic Theme helper plugin plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/_inc/client/discussion/comments.jsx 0/26 (0.00%) 0.00% 2 ❤️‍🩹
projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php 1705/2360 (72.25%) 0.17% 0 💚
projects/plugins/jetpack/modules/comments/admin.php 0/37 (0.00%) 0.00% -20 💚

Full summary · PHP report · JS report

@arcangelini
arcangelini force-pushed the update/comments-settings-screen branch from cc8b5fa to 6513a70 Compare October 18, 2026 14:27
@arcangelini arcangelini changed the title Comments: Add a settings screen with a live form preview Comments: Group the Discussion settings and add a live form preview Oct 19, 2026
@arcangelini
arcangelini force-pushed the update/comments-settings-screen branch from a2bd92f to 88d989f Compare October 19, 2026 11:20
@arcangelini arcangelini changed the title Comments: Group the Discussion settings and add a live form preview Comments: update settings menu Oct 19, 2026
@coder-karen

Copy link
Copy Markdown
Contributor

The sync replicastore on WP.com would need both new options added in order for them to be properly synced. So they'd need to be added to the options list in class.jetpack-sync-defaults.php and to the boolean group in sanitize_option in class.jetpack-sync-shadow-replicastore.php. A recent similar example of this is at 246748-ghe-Automattic/wpcom.
That said this issue won't show up in the testing steps because the form and the checks all run on the site. However if anything on WPcom is meant to read the values, it'll only see the default. Is something on WPcom meant to read the values?
Apologies if that is planned, I realize this PR is still marked in progress, but just jumping in because of the sync ping to be safe.

@arcangelini
arcangelini requested a review from a team as a code owner October 19, 2026 18:14
"projects/plugins/jetpack/_inc/client/ai/overview/index.jsx",
"projects/plugins/jetpack/_inc/client/components/module-toggle/index.jsx",
"projects/plugins/jetpack/_inc/client/components/settings-card/index.jsx",
"projects/plugins/jetpack/_inc/client/discussion/comments.jsx",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@arcangelini
arcangelini force-pushed the update/comments-settings-screen branch from cceb09b to a544927 Compare October 20, 2026 14:41
@simison

simison commented Nov 6, 2026

Copy link
Copy Markdown
Member

It actually looks like @CGastrell and @dhasilva are in the progress of moving all these Jetpack → Settings* pages elsewhere and deprecating the old settings dash (internal ref, search for project P-JETPACK-10232). So it likely makes sense to find new place for these from the start.

@CGastrell

Copy link
Copy Markdown
Contributor

Thanks for this. One question before it merges. Everything else looks fine to me.

Do sites that turned blocks off get them back? The PR removes the "Allow Blocks" setting, and Block_Editor::is_enabled() stops reading enable_blocks_comments. On trunk, its doc comment says that option is also WordPress.com's "blocks in comments" Discussion setting. If packages/comments runs on WordPress.com sites, every site that turned that setting off gets the block editor back, with no way to turn it off except the jetpack_comments_block_editor filter.

  • If those sites are affected, a small fix is to keep the old option as the default and remove only the UI:
    apply_filters( 'jetpack_comments_block_editor', (bool) get_option( 'enable_blocks_comments', true ) )
    Sites that turned blocks off stay off, and no new switch is needed.
  • If turning blocks on everywhere is intended, please say so in the description and in the changelog entries, since the setting shipped in 16.4.

Heads-up, no change needed here: we are moving the Jetpack › Settings cards to new homes, and Comments is one we have not placed yet. The two new switches will move with the rest of the card, so it is fine that they land on the current screen first.

@CGastrell

Copy link
Copy Markdown
Contributor

The Comments settings now also live in a settings panel in My Jetpack › Features (#54903, behind the my-jetpack-settings-consolidation flag). The panel reads $module.options, so this PR needs a matching change there. Without it, with the flag on, the panel keeps showing "Enable blocks in comments" (enable_blocks_comments is still in the REST list), which no longer does anything, and it does not offer the images and embeds options.

Could you rebase on trunk and add this to projects/packages/my-jetpack/_inc/components/settings-panel/comments.tsx? It swaps the blocks switch for the two new ones. Each one shows only when Jetpack sends its option, so an older Jetpack hides them. The test changes are below; the panel suites pass (91 tests), and tsgo is clean. It also needs a packages/my-jetpack changelog entry.

comments.tsx
@@ -16,7 +16,8 @@ import type { ModuleSettingsProps } from './registry';
  * @return The settings.
  */
 export function CommentsSettings( { module: $module, disabled }: ModuleSettingsProps ) {
-	const blocks = useModuleOption( $module, 'enable_blocks_comments' );
+	const images = useModuleOption( $module, 'jetpack_comments_images' );
+	const embeds = useModuleOption( $module, 'jetpack_comments_embeds' );
 	const prompt = useModuleSetting( $module, 'highlander_comment_form_prompt', v =>
 		String( v ?? '' )
 	);
@@ -24,9 +25,9 @@ export function CommentsSettings( { module: $module, disabled }: ModuleSettingsP
 	const [ draft, setDraft ] = useState< string | null >( null );
 	const optionsDisabled = ! $module.activated || disabled;
 	const labelId = useId();
-	// Jetpack versions without block comments do not send the option.
-	const blocksAvailable =
-		! Array.isArray( $module.options ) && undefined !== $module.options?.enable_blocks_comments;
+	// Older Jetpack versions do not send these options.
+	const sends = ( name: string ) =>
+		! Array.isArray( $module.options ) && undefined !== $module.options?.[ name ];
 
 	const { value: storedPrompt, setValue: savePrompt } = prompt;
 	// Saved on blur.
@@ -67,12 +68,20 @@ export function CommentsSettings( { module: $module, disabled }: ModuleSettingsP
 				<PanelModuleToggle module={ $module } labelledby={ labelId } disabled={ disabled } />
 			</Stack>
 
-			{ blocksAvailable && (
+			{ sends( 'jetpack_comments_images' ) && (
 				<SwitchControl
-					label={ __( 'Enable blocks in comments', 'jetpack-my-jetpack' ) }
-					checked={ blocks.value }
-					disabled={ optionsDisabled || blocks.isSaving }
-					onCheckedChange={ blocks.setValue }
+					label={ __( 'Allow images from links', 'jetpack-my-jetpack' ) }
+					checked={ images.value }
+					disabled={ optionsDisabled || images.isSaving }
+					onCheckedChange={ images.setValue }
+				/>
+			) }
+			{ sends( 'jetpack_comments_embeds' ) && (
+				<SwitchControl
+					label={ __( 'Allow embeds from YouTube, X, and other services', 'jetpack-my-jetpack' ) }
+					checked={ embeds.value }
+					disabled={ optionsDisabled || embeds.isSaving }
+					onCheckedChange={ embeds.setValue }
 				/>
 			) }
 			<InputControl
test/comments.test.tsx
@@ -33,13 +33,16 @@ const build = ( overrides: Partial< MyJetpackModule > = {} ) =>
 		activated: true,
 		override: false,
 		options: {
-			enable_blocks_comments: { current_value: true },
+			jetpack_comments_images: { current_value: true },
+			jetpack_comments_embeds: { current_value: true },
 			highlander_comment_form_prompt: { current_value: 'Leave a Reply' },
 		},
 		...overrides,
 	} ) as unknown as MyJetpackModule;
 
-const blocksSwitch = () => screen.queryByRole( 'switch', { name: 'Enable blocks in comments' } );
+const IMAGES = 'Allow images from links';
+const EMBEDS = 'Allow embeds from YouTube, X, and other services';
+const switchNamed = ( name: string ) => screen.queryByRole( 'switch', { name } );
 const introField = () => screen.getByRole( 'textbox', { name: 'Comment form introduction' } );
 const posts = () => mockFetch.mock.calls.map( ( [ options ] ) => options.data );
 
@@ -50,15 +53,15 @@ beforeEach( () => {
 
 describe( 'CommentsSettings', () => {
 	it.each( [
-		[ 'offers', 'Jetpack sends it', {}, true ],
+		[ 'offers', 'Jetpack sends them', {}, true ],
 		[
 			'hides',
-			'an older Jetpack leaves it out',
+			'an older Jetpack leaves them out',
 			{ options: { highlander_comment_form_prompt: { current_value: '' } } },
 			false,
 		],
 		[ 'hides', 'Jetpack sends no options', { options: [] }, false ],
-	] )( '%s the blocks option when %s', ( _verb, _when, overrides, shown ) => {
+	] )( '%s the images and embeds options when %s', ( _verb, _when, overrides, shown ) => {
 		render(
 			<CommentsSettings
 				module={ build( overrides as Partial< MyJetpackModule > ) }
@@ -66,14 +69,20 @@ describe( 'CommentsSettings', () => {
 			/>
 		);
 
-		expect( blocksSwitch() !== null ).toBe( shown );
+		expect( [ switchNamed( IMAGES ) !== null, switchNamed( EMBEDS ) !== null ] ).toEqual( [
+			shown,
+			shown,
+		] );
 	} );
 
-	it( 'saves the blocks option on its own', async () => {
+	it.each( [
+		[ IMAGES, 'jetpack_comments_images' ],
+		[ EMBEDS, 'jetpack_comments_embeds' ],
+	] )( 'saves "%s" on its own', async ( label, name ) => {
 		render( <CommentsSettings module={ build() } disabled={ false } /> );
-		await userEvent.click( blocksSwitch()! );
+		await userEvent.click( switchNamed( label )! );
 
-		expect( posts() ).toEqual( [ { enable_blocks_comments: false } ] );
+		expect( posts() ).toEqual( [ { [ name ]: false } ] );
 	} );
 
 	it( 'saves the introduction on blur, and only when it changed', async () => {
@@ -119,7 +128,8 @@ describe( 'CommentsSettings', () => {
 	] )( 'locks the options when %s', ( _name, overrides, disabled ) => {
 		render( <CommentsSettings module={ build( overrides ) } disabled={ disabled } /> );
 
-		expect( blocksSwitch() ).toHaveAttribute( 'aria-disabled', 'true' );
+		expect( switchNamed( IMAGES ) ).toHaveAttribute( 'aria-disabled', 'true' );
+		expect( switchNamed( EMBEDS ) ).toHaveAttribute( 'aria-disabled', 'true' );
 		expect( introField() ).toBeDisabled();
 	} );
 

The card change here is still needed: with the flag off, the card is what users see.

@CGastrell

Copy link
Copy Markdown
Contributor

@arcangelini, thanks for pushing this forward. We are moving the Jetpack settings to new homes (#54903), so we would like to understand the context of this change before we place it.

1. Where does this come from? We could not find the background for these changes:

  • Is there a project, initiative, or discussion behind the new "Allow images from links" and "Allow embeds from YouTube, X, and other services" switches? Did support tickets or user requests lead to them?
  • The same question for removing "Enable blocks in comments". It shipped in 16.3 (Comments: add a setting to enable the block editor #53031), so we want to make sure we follow the same plan.

A link to the issue, P2, or project is enough. It helps us keep the new settings panel in line with where Comments is going.

2. Simple sites and the blocks setting. Simple runs this same package (jetpack-mu-wpcom calls Comments::init()). On Simple, the Discussion screen (Verbum_Admin) and Calypso's site settings still show and save enable_blocks_comments. With this PR, Block_Editor::is_enabled() stops reading that option. If we read this right:

  • Simple sites that turned blocks off get the block editor back.
  • The "Allow Blocks" checkbox on Simple still shows, but does nothing.
  • Simple sites get no control for images or embeds, because they have no Jetpack › Settings screen.

Can you confirm whether this is intended? If not, one option is to keep reading enable_blocks_comments as the default and remove only the Jetpack UI.

3. Two small checks:

  • Turning off images or embeds also changes comments that already exist, because both are checked when a comment is shown. Old images and embeds show as links. Is that the expected result?
  • Karen asked whether anything on WordPress.com reads the two new options. If nothing does, we can drop the Sync change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin Page React-powered dashboard under the Jetpack menu E2E Tests Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Comments [JS Package] Webpack Config [Package] Comments [Package] Sync [Plugin] Classic Theme Helper Plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Wpcomsh RNA [Status] In Progress [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants