Skip to content

Settings: Move the Comments settings into the settings panel - #54903

Merged
CGastrell merged 4 commits into
trunkfrom
change/settings-comments-panel
Nov 13, 2026
Merged

CGastrell merged 4 commits into
trunkfrom
change/settings-comments-panel

Conversation

@CGastrell

@CGastrell CGastrell commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes JETPACK-3720

Proposed changes

Behind the my-jetpack-settings-consolidation flag (off by default). With the flag off, nothing changes.

  • Panel: Configure on Comments in My Jetpack › Features opens the settings panel (settings-panel/comments.tsx). It shows a description, a support link, the module switch (PanelModuleToggle), "Enable blocks in comments" (enable_blocks_comments) and "Comment form introduction" (highlander_comment_form_prompt). The options are locked while the module is off.
  • Blocks availability: the panel shows the blocks option only when the module sends enable_blocks_comments in its options. That option came with block comments (Comments: add a setting to enable the block editor #53031), so a Jetpack version without block comments leaves it out and the option stays hidden. Carousel hides its colour select the same way.
  • URLs: comments joins Initializer::SETTINGS_PANEL_MODULES, so its configure_url points at the panel while the flag is on.
  • Settings app (users who can manage modules): the Discussion tab gives way to search pointers (discussion/index.jsx):
  • Discussion tab: with the flag on, admins get no Discussion tab, and #/discussion sends them to the Comments panel (main.jsx). Users who cannot manage modules never had a Discussion tab, and their #/discussion already goes to #/settings. A Settings search still shows them the classic Comments card, as on trunk.
  • Redirect map: comments and /discussion point at the Comments panel. /discussion keeps users who cannot manage modules on Settings until D9, and is marked alreadyRedirects. gravatar-hovercards and the new comment-likes source point at their Features rows. The D2 marker on these entries was already replaced by JETPACK-3720 in Settings: Move the Markdown settings into the settings panel #54891.

Related product discussion/links

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

No new data. The module switch and the blocks switch send the existing panel Tracks events (origin: my-jetpack-settings-panel). The introduction text is not recorded.

Testing instructions

Needs a connected site: Comments needs a connection, so in offline mode the panel shows locked.

  1. Turn the flag on, for example with an mu-plugin:
    add_filter( 'jetpack_feature_flag_enabled_my-jetpack-settings-consolidation', '__return_true' );
  2. Go to My Jetpack › Features, search "comments", and click Configure on Comments. The Comments panel opens.
  3. Turn "Enable blocks in comments" off. Change "Comment form introduction" and move focus out of the field. Each shows "Updated settings."
  4. Reload. Both values stay.
  5. Open a post with comments open, logged out. The comment form title shows the new introduction.
  6. Turn the module switch off. Both options lock. Turn it back on.
  7. Go to Jetpack › Settings. There is no Discussion tab. Open admin.php?page=jetpack-settings#/discussion: it opens the Comments panel.
  8. Search Settings for "comment". The Discussion section shows a Comments card that opens the panel, and Gravatar Hovercards and Comment Likes cards that open Features filtered to that row.
  9. Turn the flag off. Settings shows the Discussion tab and the Comments card as on trunk.

Unit tests: comments.test.tsx (panel), discussion.test.jsx, and new rows in the nav-tab and route tests.

@CGastrell CGastrell added [Status] In Progress Admin Page React-powered dashboard under the Jetpack menu [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Package] My Jetpack [Tests] Includes Tests labels Nov 12, 2026
@CGastrell CGastrell self-assigned this Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 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), and enable the change/settings-comments-panel branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack change/settings-comments-panel

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 commented Nov 12, 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.

@jp-launch-control

jp-launch-control Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 7 files. Only the first 5 are listed here.

File Coverage Δ% Δ Uncovered
projects/packages/my-jetpack/_inc/components/settings-panel/use-module-option.ts 23/23 (100.00%) 0.00% 0 💚
projects/plugins/jetpack/_inc/client/lib/settings-consolidation/index.js 17/17 (100.00%) 0.00% 0 💚
projects/plugins/jetpack/_inc/client/main.jsx 65/102 (63.73%) 2.27% 0 💚
projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/index.jsx 44/59 (74.58%) 0.81% -1 💚
projects/plugins/jetpack/_inc/client/state/initial-state/reducer.js 54/108 (50.00%) 0.93% -1 💚

4 files are newly checked for coverage.

File Coverage
projects/plugins/jetpack/_inc/client/discussion/comments-moved.jsx 0/2 (0.00%) 💔
projects/plugins/jetpack/_inc/client/writing/markdown-moved.jsx 0/2 (0.00%) 💔
projects/packages/my-jetpack/_inc/components/settings-panel/comments.tsx 14/14 (100.00%) 💚
projects/packages/my-jetpack/_inc/components/settings-panel/markdown.tsx 5/5 (100.00%) 💚

Full summary · PHP report · JS report

Coverage check overridden by Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code .

@CGastrell
CGastrell force-pushed the change/settings-comments-panel branch 2 times, most recently from d368df3 to 71248b3 Compare November 12, 2026 21:40
@CGastrell
CGastrell marked this pull request as ready for review November 12, 2026 21:41

@dhasilva dhasilva left a comment

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.

I reviewed the three commits on top of #54891 (efdf1ad, 71248b3, 95b6a69) at 95b6a69. I found no blockers and left three suggestions inline.

What I ran, in a worktree at the head: the my-jetpack settings-panel Jest suites (10 suites, 90 tests), the Jetpack plugin's test-gui (74 suites, 721 tests) and test-client (54 suites, 851 tests), and my-jetpack tsgo. Everything passes, and CI's Static analysis jobs are green. I did not click through it on a live site.

Checked and fine:

  • Only admins reach the #/discussion → panel redirect, because non-admins get NonAdminView before the route switch.
  • The nav tab change sits inside the userCanManageModules branch.
  • isModuleFound() returns false for a module that isn't loaded, so the destructure in pointTo() can't hit undefined.
  • Features search matches the translated module name, so search={ name } works in every locale, as it does in Composing.
  • Comments, Comment Likes and Gravatar Hovercards all have Features rows (in the Engagement group).
  • isInSettingsPanel() gives the same result as the old checks at all three call sites.

Description: it says to review only the last commit, but this PR has three commits on top of #54891. Also, #54893 has merged, so the offline crash note under Testing instructions can go.

Generated by Claude.

Comment on lines +30 to +32
const blocksAvailable =
( getScriptData() as JetpackPluginScriptData | undefined )?.jetpack
?.isCommentBlocksAvailable === true;

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.

[suggestion] The module already tells the panel whether blocks are available, so the new script-data key isn't needed. enable_blocks_comments joined the /jetpack/v4 options in #53031, in the same commit that added isCommentBlocksAvailable. So an option that is missing from $module.options is exactly the "older plugin" case. Comments::is_enabled() is false only for blog 522232 on WordPress.com, which never renders My Jetpack. Carousel already works this way: it hides its colour select when Jetpack sends no choices.

Suggested change
const blocksAvailable =
( getScriptData() as JetpackPluginScriptData | undefined )?.jetpack
?.isCommentBlocksAvailable === true;
const blocksAvailable =
! Array.isArray( $module.options ) && undefined !== $module.options?.enable_blocks_comments;

With that change, the JetpackPluginScriptData type, the getScriptData import and the PHP lines in class-jetpack-script-data.php can all go. That removes the plugin→package contract. It also means a Jetpack release from after #53031 but before this PR shows the option instead of hiding an option that works. The three it.each rows would then vary the module's options instead of window.JetpackScriptData.

Generated by Claude.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in f472875: the panel checks $module.options for enable_blocks_comments. The script-data key, type and PHP lines are gone, and the test rows vary the options.

$data['jetpack']['themeSupports'] = array(
'infiniteScroll' => self::theme_supports_infinite_scroll(),
);
$data['jetpack']['isCommentBlocksAvailable'] = Comments::is_enabled();

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.

[suggestion] This line (and the use on L12) can go if the panel reads $module.options instead, as suggested on comments.tsx L30–32.

Generated by Claude.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in f472875.

Comment on lines +55 to +57
setPending( value );
const result = queue.current.then( () => send( value ) );
queue.current = result;

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.

[suggestion] The queue never holds more than one save. comments.tsx disables the field while isSaving, so no second blur can start a save while one is running. (Google Analytics needs its queue because its switches stay enabled while the ID saves.) Without the queue, this hook is useModuleSetting() from use-module-option.ts with a String parse, except that it reports whether the save worked.

If useModuleSetting's setValue resolves to true/false (add return true; in the try and return false; in the catch; its three callers ignore the result), the panel can use:

const prompt = useModuleSetting( $module, 'highlander_comment_form_prompt', v => String( v ?? '' ) );
const { value: storedPrompt, setValue: savePrompt } = prompt;

Then this file can go, leaving one copy of the POST and its notices instead of two. I tried this in a worktree: all 90 settings-panel tests pass, including comments.test.tsx unchanged, and tsgo is clean.

Generated by Claude.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in f472875: useModuleSetting's setValue resolves to true/false, the panel uses it with a String parse, and use-module-text-setting.ts is gone.

Comment on lines +135 to +137
"rules": [
{ "destination": "admin.php?page=my-jetpack&p=%2Ffeatures%3Fconfigure%3Dcomments" }
],

@dhasilva dhasilva Nov 12, 2026 •

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.

[suggestion] This rule is missing two things its sibling routes have:

  • Non-admins. Today a non-admin who opens #/discussion lands on #/settings. Once the redirect document reads this rule, it will send them to My Jetpack, which they can't open. /reader has no non-admin tab either, but its first rule is canManageModules: false → pending D9. The same rule here keeps them on Settings until the D9 change lands, and then /discussion moves along with the other D9 routes. (/performance has the same gap.)
  • alreadyRedirects. main.jsx now does this redirect, so the rule can carry "alreadyRedirects": true, like /performance, /sharing and /reader. (The /writing rule from Settings: Move the Markdown settings into the settings panel #54891 is missing it too.)
Suggested change
"rules": [
{ "destination": "admin.php?page=my-jetpack&p=%2Ffeatures%3Fconfigure%3Dcomments" }
],
"rules": [
{ "when": { "canManageModules": false }, "pending": [ "D9" ] },
{
"destination": "admin.php?page=my-jetpack&p=%2Ffeatures%3Fconfigure%3Dcomments",
"alreadyRedirects": true
}
],

Generated by Claude.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in f472875. I checked the siblings too: /writing already had the D9 rule but no alreadyRedirects, and /performance had alreadyRedirects but no D9 rule (non-admins who are not subscribers do reach #/performance in NonAdminView). Both are fixed in #54891 (b9ec108).

@CGastrell
CGastrell force-pushed the change/settings-comments-panel branch from 95b6a69 to f472875 Compare November 12, 2026 22:40
@CGastrell CGastrell added Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code and removed [Status] In Progress labels Nov 13, 2026
@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Nov 13, 2026
CGastrell and others added 4 commits November 13, 2026 11:13
Behind the my-jetpack-settings-consolidation flag. The My Jetpack panel
holds the Comments module switch, the blocks-in-comments option and the
comment form introduction, which saves on blur. The Jetpack plugin prints
comment block availability to My Jetpack script data; without it, the
panel hides the blocks option.

With the flag on, admins get search pointers instead of the Comments
card, the Discussion tab hides, and #/discussion opens the panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
isInSettingsPanel() holds the flag + manage_modules check that Composing,
Discussion and Post by Email each wrote inline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gate now comes from connect(), which the unconnected render skips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The panel shows the blocks option when the module sends it, so the
Jetpack plugin no longer prints isCommentBlocksAvailable. The
introduction saves through useModuleSetting(), which now resolves to
whether the save worked. Users who cannot manage modules keep
/discussion until D9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CGastrell
CGastrell force-pushed the change/settings-comments-panel branch from f472875 to 4854156 Compare November 13, 2026 14:14
@CGastrell CGastrell added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Nov 13, 2026
@CGastrell
CGastrell merged commit 697afca into trunk Nov 13, 2026
131 of 133 checks passed
@CGastrell
CGastrell deleted the change/settings-comments-panel branch November 13, 2026 14:38
@github-actions github-actions Bot added this to the jetpack/16.5 milestone Nov 13, 2026
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Review This PR is ready for review. labels Nov 13, 2026

@dhasilva dhasilva left a comment

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.

Follow-up after the merge: I rechecked the final head, 4854156, against my review of 95b6a69.

My four suggestions landed as proposed:

  • The panel reads enable_blocks_comments from $module.options. The script-data key, its type and the PHP lines are gone.
  • useModuleSetting()'s setValue resolves to true or false, and use-module-text-setting.ts is gone. The other callers ignore the result, so nothing else changes.
  • /discussion has the canManageModules: false → D9 rule and alreadyRedirects. /writing and /performance got theirs in #54891.

New: I left one suggestion inline, on a redirect-map entry. Nothing reads the map yet, so the fix can wait for the PR that first reads it, or go into the next consolidation PR.

I didn't rerun the test suites this time. The comment-length and stale-comment checks are clean. At merge, the only failing job was coverage publishing, which this change doesn't affect.

Generated by Claude.

},
{
"source": "comment-likes",
"rules": [ { "destination": "admin.php?page=my-jetpack#/features?search=comment%20likes" } ]

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.

[suggestion] search=comment%20likes finds Comment Likes only when the translated name or description still contains "comment". Features requires every word to match a module's name, search_terms or description (scoreFields(), moduleFields()). Only the name and description are translated. Comment Likes' search terms stay in English (like widget, like button, like, likes) and don't include "comment". So in a locale that translates "comment", the word matches nothing on Comment Likes, and the module drops out of the results.

The Discussion pointer works in every locale, because search={ name } sends the same translated name that Features shows. The gravatar entry above is fine too, because "gravatar" is one of that module's search terms. search=likes would match in every locale, though Likes ranks above Comment Likes. Alternatively, the redirect document could build the term from the translated module name, as the pointer does.

Generated by Claude.

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 Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code [Package] My Jetpack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants