Repository navigation
Settings: Move the Markdown settings into the settings panel - #54891
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 3 files.
2 files are newly checked for coverage.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
dhasilva
left a comment
There was a problem hiding this comment.
Reviewed at 5d39401. JS tests, typecheck, ESLint and coverage are green. The two red jobs are unrelated: PHP 8.4 WP trunk fails in Jetpack_Email_Design_Editor_Test on a core mysql2date() redeclare, and the other is a Boost e2e job.
Checked and fine:
- Users who cannot manage modules keep their Writing tab and never reach the
/writingredirect.settings-nav-tabsonly changes theuserCanManageModulesbranch, andMainsends everyone else toNonAdminViewbefore the route switch. - With the flag on, nothing on Writing renders for admins without a search. Hiding the tab strands nothing.
- On the
/writingdefault you asked about:#/featureslooks right to me, since no single search covers the tab. Two links still point at#/writingand now land on unfiltered Features with the flag on: the fixUrl inUnavailable_Blocks::get_editor_data()( ), which the map already says wants?search=blocks, and the wpcomsh notice on Settings › Writing ( ), which still says "Jetpack Settings". Before this PR, the blocks link with the flag on reached a Writing tab with no Blocks toggle, so this is a step forward. Both are worth fixing where they are defined before the flag flips, not in this PR.
No blockers. Three suggestions inline.
Generated by Claude.
| <Text variant="body-md" id={ labelId }> | ||
| { __( 'Enable Markdown', 'jetpack-my-jetpack' ) } | ||
| </Text> | ||
| <PanelModuleToggle module={ $module } labelledby={ labelId } disabled={ disabled } /> |
There was a problem hiding this comment.
[suggestion] One row of the coupling table in the description doesn't match the server: "Turning the module on keeps the stored option values (they also survive off and on)". This switch POSTs jetpack/v4/module/markdown/active. register_endpoints() loads the module endpoints file on every REST request (
jetpack_activate_module_markdown to set wpcom_publish_posts_with_markdown to true (Related, and older than this PR: Jetpack::plugin_upgrade() turns the posts option back on at every Jetpack version change, whether or not the module is on (
jetpack/projects/plugins/jetpack/class.jetpack.php
Lines 502 to 505 in 5d39401
Generated by Claude.
There was a problem hiding this comment.
Right, thanks. I fixed the table row in the description: activation sets the posts option, and only the comments option survives off and on. Filed the plugin_upgrade() reset as a follow-up: JETPACK-3729.
| // The panel needs Features, which users who cannot manage modules lack. | ||
| isMarkdownMoved: isSettingsConsolidationEnabled() && userCanManageModules( state ), |
There was a problem hiding this comment.
[suggestion] This gate is written twice, here and in discussion/index.jsx (L73-L79). The comment repeats the reason already in the isSwitchedInFeatures() docblock (
isSwitchedInFeatures(), say isInSettingsPanel( state, module ), would hold the gate and its reason in one place. The Comments panel (JETPACK-3720) needs it next, so it can wait for that PR.
Generated by Claude.
| "matching": "`everySource` runs before any route or term rule. A term matches its decoded value, case-insensitively, before its route; an unmatched term falls back to its route. On page=jetpack-settings, an empty hash (the bare menu link) or an unknown route gets the /settings rules, as main.jsx does. On page=jetpack, an unknown route never reaches these rules: the forwarder (Jetpack_React_Page::get_legacy_route_redirects()) sends it to My Jetpack for admins and to Settings for everyone else, as it does today, so #/my-plan, #/dashboard and #/stats keep landing on My Jetpack. In each list, the first rule whose `when` all hold wins, and a rule without `when` is the default. A rule with `pending` keeps the source on Settings until each marker clears: `D<n>` is an open decision, `JETPACK-<n>` an issue that must land, `flag:<name>` a feature flag that must retire, `error-notice-home` a new home for the Jetpack::state( 'error' ) notice, which only Settings shows today, and `monetize-page` a Monetize page that shows the Ads settings (its flag on and the `monetize` module active), without which the Ads settings stay on Settings. A `destination` next to `pending` is where the source goes once it clears. A settings panel destination (`configure=`) waits on the issue that gives the panel that module's settings, since until then the panel's fallback links back here through configure_url. Destinations are relative to wp-admin. My Jetpack `#/` links work on every My Jetpack version, since its router rewrites them to `?p=`.", | ||
| "decisions": { | ||
| "D2": "Whether Comments' settings (with Gravatar Hovercards and Markdown for comments) get one settings panel or become Features switches, and where the Markdown option goes.", | ||
| "D2": "Whether Comments' settings (with Gravatar Hovercards) get one settings panel or become Features switches.", |
There was a problem hiding this comment.
[suggestion] D2 is decided: JETPACK-3720 opens with "Decided on 2026-11-12 (D2)". The map's matching text uses D<n> for an open decision and JETPACK-<n> for an issue that must land, so this entry now lists a decided question as open. The comments, gravatar-hovercards and /discussion entries could become pending: [ "JETPACK-3720" ], and D2 could go now. 3720 plans to drop D2 once both issues are done, and this swap keeps the map accurate until then.
Generated by Claude.
There was a problem hiding this comment.
Done in 2610240: the three entries now wait on JETPACK-3720, and D2 is gone.
|
The two |
Behind the my-jetpack-settings-consolidation flag. Configure on Markdown opens a panel with the module switch and the posts and comments options. Settings hides the Markdown controls for users who can manage modules, and a search for Markdown points to the panel.
With settings consolidation on, every Writing card has moved, so admins get no Writing tab and #/writing opens Features.
D2 is decided, so the comments, gravatar-hovercards and /discussion entries now wait on the issue that moves them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2610240 to
256d554
Compare
/writing gets alreadyRedirects, since main.jsx redirects it. Users who cannot manage modules keep /performance until D9, as on /writing and /reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes JETPACK-3721
Proposed changes
Behind the
my-jetpack-settings-consolidationflag (off by default). With the flag off, nothing changes.Panel: Configure on Markdown in My Jetpack › Features opens the settings panel (
settings-panel/markdown.tsx). It shows a description, a support link, the module switch ("Enable Markdown"), and two switches: "Write posts and pages with Markdown" (wpcom_publish_posts_with_markdown) and "Let readers use Markdown in comments" (wpcom_publish_comments_with_markdown). Each option saves on change throughjetpack/v4/settings.URLs:
markdownjoinsInitializer::SETTINGS_PANEL_MODULES, so itsconfigure_urlpoints at the panel while the flag is on.Settings app: for users who can manage modules, the Composing card no longer shows the Markdown toggle, and the Comments card no longer shows "Enable Markdown use for comments". A Settings search for Markdown shows a card that links to the panel (
writing/markdown-moved.jsx). Users who cannot manage modules have no Features, so they keep the old controls, as Composing does for its other modules.Discussion: the Markdown gate is in
discussion/index.jsx(itsisModuleFound), sodiscussion/comments.jsxis not touched (Comments: update settings menu #53538 rewrites it). This also stops a Markdown search from printing an empty "Discussion" heading.Writing tab: with the flag on, admins get no Writing tab, and
#/writingsends them toadmin.php?page=my-jetpack#/features(main.jsx, as Settings: Move the Reader Visibility card to Features #54817, Settings: Move the Sharing buttons and Like buttons cards to Features #54819 and Settings: Move the Site Accelerator card to Features #54820 do for their tabs). The tab rule incomponents/settings-nav-tabs/index.jsxused to keep the tab formarkdown,post-by-emailandinfinite-scroll, which have all moved. With the flag on, nothing keeps it for admins:A Settings search still shows those pointers, because search runs on
#/settings?term=. Users who cannot manage modules keep their Writing tab (Post by Email), as before; they never reach the route redirect.Redirect map:
markdownnow points at the panel./writingdrops its D2 marker and gets the same default as/traffic,admin.php?page=my-jetpack#/features, because no Writing card is left for admins with the flag on; it is markedalreadyRedirects, sincemain.jsxdoes that redirect. D2 is decided, so it is gone, and/discussion,commentsandgravatar-hovercardsnow wait on JETPACK-3720./performancegets the D9 rule for users who cannot manage modules, as/writingand/readerhave.Coupling of the switch and the options
The panel switch owns activation, as in the Carousel panel. The two options stay visible but locked while the module is off.
Differences from the Settings controls:
jetpack_wpa_module_toggleand the settings toggle eventsjetpack_wpa_module_togglewithorigin: my-jetpack-settings-panel; the option switches send the panel's setting toggle eventjetpacktext domainjetpack-my-jetpackSo with the module on and both options off, Markdown does nothing until a user turns an option on.
Side effect with the flag on, for admins
The "Learn more about all Jetpack AI features" link was inside the Composing card. Markdown was the last module that kept that card, so the link goes with it.
Screenshots (flag on, admin)
Plan (as approved)
markdown.tsx, copied from the Carousel panel pattern (PanelModuleToggleplususeModuleOptionswitches), register it, and addmarkdowntoSETTINGS_PANEL_MODULES.isSettingsConsolidationEnabled()for users who can manage modules, with a search pointer to the panel.#/writingto Features.Related product discussion/links
Does this pull request change what data or activity we track or use?
No new data. With the flag on, the panel's switches send the existing panel Tracks events (
origin: my-jetpack-settings-panel), as the other panels do.Testing instructions
Run:
cd projects/packages/my-jetpack && pnpm exec jest --config=tests/jest.config.js && pnpm run typecheckcd projects/plugins/jetpack && NODE_PATH=tests:_inc/client pnpm exec jest --config=tests/jest.config.gui.jsand--config=tests/jest.config.client.jsjetpack test php packages/my-jetpackManual checks, run by the author on a local Docker site with two mu-plugin filters:
add_filter( 'jetpack_feature_flag_enabled_my-jetpack-settings-consolidation', '__return_true' );andadd_filter( 'jetpack_offline_mode', '__return_false' );(the second because the site is onlocalhost; offline mode is JETPACK-3727).wp-admin/admin.php?page=my-jetpack#/features?configure=markdown. The Markdown panel opens. With the module off, both options are locked.wp option get/ the module state agree.?configure=markdown. (Configure shows only while a module is on, as for the other panels.)admin.php?page=jetpack-settings#/writinglands on My Jetpack › Features.Not run by the author: a user who cannot manage modules (they should keep the old controls and their Writing tab).
Coverage (
Covered by non-unit tests):markdown-moved.jsxand the Discussion gate have no unit test. The Composing test mocks the pointer, aswriting.test.jsxmocks the other pointers, and manual steps 5 and 6 cover both. There is no new row inSettings_Panel_Url_Test.php: its tests cover the mechanism withrelated-posts, and a row per list entry would catch no bug the list itself does not show (the Carousel and Infinite Scroll PRs added none).Phan crashes on the host PHP 8.5 while parsing
vendor/php-stubs/wordpress-stubs, before it reaches this code, so Phan is left to CI.The
400console errors on My Jetpack also show on trunk.