Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d6c8b6f
Comments: Add a settings screen with a live form preview
arcangelini Oct 13, 2026
611d278
Fix Phan
arcangelini Oct 18, 2026
99a51f2
Move comment settings back into the Discussion tab
arcangelini Oct 19, 2026
df1e398
Address review nits
arcangelini Oct 19, 2026
e4db9ff
Move the preview above the comment form settings
arcangelini Oct 19, 2026
94c5769
Show the current user as the commenter in the preview
arcangelini Oct 19, 2026
525c8ce
Add settings for images and embeds in comments
arcangelini Oct 19, 2026
617cdd1
Don't indent the blocks toggle
arcangelini Oct 19, 2026
fa8b003
Address review nits
arcangelini Oct 19, 2026
3cf276c
Build the comment settings with DataForm in the comments package
arcangelini Oct 19, 2026
ec51ca7
Restore tracking and the unsaved changes warning
arcangelini Oct 19, 2026
8012759
Remove the setting to turn off blocks in comments
arcangelini Oct 20, 2026
a544927
Match trunk's Discussion section title
arcangelini Oct 20, 2026
f7c981b
Ship the comment settings card as the package's own bundle
arcangelini Oct 20, 2026
0473383
Merge remote-tracking branch 'origin/trunk' into modernize/53538
arcangelini Nov 5, 2026
1ff1320
Fix the settings bundle's i18n check
arcangelini Nov 5, 2026
097b90a
Drop the preview and move the comment form card into the plugin
arcangelini Nov 5, 2026
0907609
Update changelog
arcangelini Nov 5, 2026
05c070e
Space the Discussion cards
arcangelini Nov 5, 2026
ca0c6dc
Match the Discussion card to the other Settings tabs
arcangelini Nov 5, 2026
ca3d3c6
Update changelog
arcangelini Nov 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Add site settings to turn images and embeds in comments on or off. Blocks in comments are always on.
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ public static function is_enabled() {
*
* @since 0.4.0
*
* @param bool $enabled Whether to offer the block editor. Default true, unless WordPress.com's
* "blocks in comments" Discussion setting is off.
* @param bool $enabled Whether to offer the block editor. Default true.
*/
return (bool) apply_filters( 'jetpack_comments_block_editor', (bool) get_option( 'enable_blocks_comments', true ) );
return (bool) apply_filters( 'jetpack_comments_block_editor', true );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/comments/src/editor/class-embeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public static function is_enabled() {
*
* @since 0.5.0
*
* @param bool $enabled Whether to offer it. Default true, wherever the block editor is on.
* @param bool $enabled Whether to offer it. Default the site's setting, which starts on, wherever the block editor is on.
*/
return Comments::is_enabled() && Block_Editor::is_enabled() && (bool) apply_filters( 'jetpack_comments_block_editor_embeds', true );
return Comments::is_enabled() && Block_Editor::is_enabled() && (bool) apply_filters( 'jetpack_comments_block_editor_embeds', (bool) get_option( 'jetpack_comments_embeds', true ) );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/comments/src/editor/class-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public static function is_enabled() {
*
* @since 0.6.0
*
* @param bool $enabled Whether to offer it. Default true, wherever the block editor is on.
* @param bool $enabled Whether to offer it. Default the site's setting, which starts on, wherever the block editor is on.
*/
return Block_Editor::is_enabled() && (bool) apply_filters( 'jetpack_comments_block_editor_images', true );
return Block_Editor::is_enabled() && (bool) apply_filters( 'jetpack_comments_block_editor_images', (bool) get_option( 'jetpack_comments_images', true ) );
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Add the Jetpack Comments image and embed settings to the synced options.
2 changes: 2 additions & 0 deletions projects/packages/sync/src/class-defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class Defaults {
'jetpack_available_modules',
'jetpack_comment_form_color_scheme',
'jetpack_comment_likes_enabled',
'jetpack_comments_embeds',
'jetpack_comments_images',
'jetpack_excluded_extensions',
'jetpack_holiday_snow_enabled',
'jetpack_mailchimp',
Expand Down
68 changes: 48 additions & 20 deletions projects/plugins/jetpack/_inc/client/discussion/comments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ class CommentsComponent extends Component {
this.props.updateFormStateModuleOption( 'markdown', 'wpcom_publish_comments_with_markdown' );
};

handleBlocksToggle = () => {
this.props.updateFormStateModuleOption( 'comments', 'enable_blocks_comments' );
handleImagesToggle = () => {
this.props.updateFormStateModuleOption( 'comments', 'jetpack_comments_images' );
};

handleEmbedsToggle = () => {
this.props.updateFormStateModuleOption( 'comments', 'jetpack_comments_embeds' );
};

render() {
Expand Down Expand Up @@ -69,7 +73,8 @@ class CommentsComponent extends Component {
module="comments"
saveDisabled={ this.props.isSavingAnyOption( [
'highlander_comment_form_prompt',
'enable_blocks_comments',
'jetpack_comments_images',
'jetpack_comments_embeds',
] ) }
>
{ foundComments && (
Expand Down Expand Up @@ -98,23 +103,46 @@ class CommentsComponent extends Component {
<span className="jp-form-toggle-explanation">{ comments.description }</span>
</ModuleToggle>
{ this.props.hasBlockEditor && (
<FormFieldset>
<ToggleControl
checked={ !! this.props.getOptionValue( 'enable_blocks_comments', 'comments' ) }
disabled={
! isCommentsActive ||
commentsUnavailableInOfflineMode ||
this.props.isSavingAnyOption( [ 'comments', 'enable_blocks_comments' ] )
}
onChange={ this.handleBlocksToggle }
label={
<span className="jp-form-toggle-explanation">
{ __( 'Enable blocks in comments.', 'jetpack' ) }
</span>
}
__nextHasNoMarginBottom={ true }
/>
</FormFieldset>
<>
<FormFieldset>
<ToggleControl
checked={
!! this.props.getOptionValue( 'jetpack_comments_images', 'comments' )
}
disabled={
! isCommentsActive ||
commentsUnavailableInOfflineMode ||
this.props.isSavingAnyOption( [ 'comments', 'jetpack_comments_images' ] )
}
onChange={ this.handleImagesToggle }
label={
<span className="jp-form-toggle-explanation">
{ __( 'Allow images from links.', 'jetpack' ) }
</span>
}
__nextHasNoMarginBottom={ true }
/>
</FormFieldset>
<FormFieldset>
<ToggleControl
checked={
!! this.props.getOptionValue( 'jetpack_comments_embeds', 'comments' )
}
disabled={
! isCommentsActive ||
commentsUnavailableInOfflineMode ||
this.props.isSavingAnyOption( [ 'comments', 'jetpack_comments_embeds' ] )
}
onChange={ this.handleEmbedsToggle }
label={
<span className="jp-form-toggle-explanation">
{ __( 'Allow embeds from YouTube, X, and other services.', 'jetpack' ) }
</span>
}
__nextHasNoMarginBottom={ true }
/>
</FormFieldset>
</>
) }
<FormFieldset>
<FormLabel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,20 @@ public static function get_updateable_data_list( $selector = '' ) {
'validate_callback' => __CLASS__ . '::validate_boolean',
'jp_group' => 'comments',
),
'jetpack_comments_images' => array(
'description' => esc_html__( 'Allow images in comments', 'jetpack' ),
'type' => 'boolean',
'default' => 1,
'validate_callback' => __CLASS__ . '::validate_boolean',
'jp_group' => 'comments',
),
'jetpack_comments_embeds' => array(
'description' => esc_html__( 'Allow embeds in comments', 'jetpack' ),
'type' => 'boolean',
'default' => 1,
'validate_callback' => __CLASS__ . '::validate_boolean',
'jp_group' => 'comments',
),

// Custom Content Types.
'jetpack_portfolio' => array(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

Discussion: Add settings for images and embeds in comments, and remove the setting to turn off blocks in comments.
44 changes: 0 additions & 44 deletions projects/plugins/jetpack/modules/comments/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* @package automattic/jetpack
*/

use Automattic\Jetpack\Comments\Comments;

if ( ! defined( 'ABSPATH' ) ) {
exit( 0 );
}
Expand Down Expand Up @@ -104,48 +102,6 @@ public function add_settings() {
'highlander_comment_form_prompt',
array( $this, 'comment_form_greeting_sanitize' )
);

if ( ! Comments::is_enabled() ) {
return;
}

add_settings_field(
'enable_blocks_comments',
__( 'Allow Blocks', 'jetpack' ),
array( $this, 'allow_blocks_field' ),
'discussion',
'jetpack_comment_form'
);

register_setting(
'discussion',
'enable_blocks_comments',
array( $this, 'allow_blocks_sanitize' )
);
}

/**
* Blocks in comments setting.
*/
public function allow_blocks_field() {
?>

<label>
<input name="enable_blocks_comments" type="checkbox" value="1" <?php checked( (bool) get_option( 'enable_blocks_comments', true ) ); ?>>
<?php esc_html_e( 'Enable blocks in comments', 'jetpack' ); ?>
</label>

<?php
}

/**
* Sanitize the blocks in comments setting.
*
* @param mixed $val The submitted value.
* @return string
*/
public function allow_blocks_sanitize( $val ) {
return $val ? '1' : '0';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ public function test_sync_default_options() {
'wpcom_site_setup' => '',
'jetpack_verbum_subscription_modal' => true,
'enable_blocks_comments' => '1',
'jetpack_comments_images' => true,
'jetpack_comments_embeds' => true,
'jetpack_blocks_disabled' => false,
'wpcom_ai_site_prompt' => '',
'reader_chat' => false,
Expand Down
Loading