From 1f779a6ece98dc522f7425e4d58b89f31be86372 Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Thu, 12 Nov 2026 16:30:24 -0300 Subject: [PATCH 1/4] Settings: Move the Markdown settings into the settings panel 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. --- .../components/settings-panel/markdown.tsx | 66 +++++++++++++++ .../components/settings-panel/registry.ts | 2 + .../settings-panel/test/markdown.test.tsx | 82 +++++++++++++++++++ .../changelog/change-settings-markdown-panel | 5 ++ .../my-jetpack/src/class-initializer.php | 2 +- .../jetpack/_inc/client/discussion/index.jsx | 10 ++- .../jetpack/_inc/client/writing/composing.jsx | 18 ++-- .../_inc/client/writing/markdown-moved.jsx | 19 +++++ .../client/writing/test/composing.test.jsx | 19 ++++- .../admin-pages/settings-redirect-map.json | 11 ++- .../changelog/change-settings-markdown-panel | 5 ++ 11 files changed, 227 insertions(+), 12 deletions(-) create mode 100644 projects/packages/my-jetpack/_inc/components/settings-panel/markdown.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/settings-panel/test/markdown.test.tsx create mode 100644 projects/packages/my-jetpack/changelog/change-settings-markdown-panel create mode 100644 projects/plugins/jetpack/_inc/client/writing/markdown-moved.jsx create mode 100644 projects/plugins/jetpack/changelog/change-settings-markdown-panel diff --git a/projects/packages/my-jetpack/_inc/components/settings-panel/markdown.tsx b/projects/packages/my-jetpack/_inc/components/settings-panel/markdown.tsx new file mode 100644 index 000000000000..d3cd93c4d00e --- /dev/null +++ b/projects/packages/my-jetpack/_inc/components/settings-panel/markdown.tsx @@ -0,0 +1,66 @@ +import { getRedirectUrl } from '@automattic/jetpack-components'; +import { __ } from '@wordpress/i18n'; +import { Link, Stack, SwitchControl, Text } from '@wordpress/ui'; +import { useId } from 'react'; +import { PanelModuleToggle } from './panel-module-toggle'; +import styles from './styles.module.scss'; +import { useModuleOption } from './use-module-option'; +import type { ModuleSettingsProps } from './registry'; + +/** + * The Markdown options. + * + * @param props - Component props. + * @param props.module - The module. + * @param props.disabled - Whether the site cannot use the module. + * @return The settings. + */ +export function MarkdownSettings( { module: $module, disabled }: ModuleSettingsProps ) { + const posts = useModuleOption( $module, 'wpcom_publish_posts_with_markdown' ); + const comments = useModuleOption( $module, 'wpcom_publish_comments_with_markdown' ); + const optionsDisabled = ! $module.activated || disabled; + const labelId = useId(); + + return ( + + + { __( + 'Use Markdown syntax to compose content with links, lists, and other styles. This setting enables Markdown in the Classic Editor as well as within a Classic Editor block.', + 'jetpack-my-jetpack' + ) } + + + { __( 'Learn more about Markdown', 'jetpack-my-jetpack' ) } + + + + + { __( 'Enable Markdown', 'jetpack-my-jetpack' ) } + + + + + + + + ); +} diff --git a/projects/packages/my-jetpack/_inc/components/settings-panel/registry.ts b/projects/packages/my-jetpack/_inc/components/settings-panel/registry.ts index 0229490abd5d..74eac871c66a 100644 --- a/projects/packages/my-jetpack/_inc/components/settings-panel/registry.ts +++ b/projects/packages/my-jetpack/_inc/components/settings-panel/registry.ts @@ -1,6 +1,7 @@ import { CarouselSettings } from './carousel'; import { GoogleAnalyticsSettings } from './google-analytics'; import { InfiniteScrollSettings } from './infinite-scroll'; +import { MarkdownSettings } from './markdown'; import { PostByEmailSettings } from './post-by-email'; import { RelatedPostsSettings } from './related-posts'; import { SeoSettings } from './seo'; @@ -23,6 +24,7 @@ export type ModuleSettingsProps = { export const moduleSettings: Record< string, ComponentType< ModuleSettingsProps > > = { carousel: CarouselSettings, 'infinite-scroll': InfiniteScrollSettings, + markdown: MarkdownSettings, 'post-by-email': PostByEmailSettings, 'related-posts': RelatedPostsSettings, 'seo-tools': SeoSettings, diff --git a/projects/packages/my-jetpack/_inc/components/settings-panel/test/markdown.test.tsx b/projects/packages/my-jetpack/_inc/components/settings-panel/test/markdown.test.tsx new file mode 100644 index 000000000000..6d946b46f54a --- /dev/null +++ b/projects/packages/my-jetpack/_inc/components/settings-panel/test/markdown.test.tsx @@ -0,0 +1,82 @@ +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import apiFetch from '@wordpress/api-fetch'; +import { MarkdownSettings } from '../markdown'; +import type { MyJetpackModule } from '../../../types'; + +jest.mock( '@wordpress/api-fetch', () => jest.fn() ); +jest.mock( '@automattic/jetpack-shared-stores', () => ( { store: {} } ) ); +jest.mock( '@wordpress/notices', () => ( { store: 'core/notices' } ) ); +jest.mock( '@wordpress/data', () => ( { + useDispatch: () => ( { + fetchModules: jest.fn(), + createErrorNotice: jest.fn(), + createSuccessNotice: jest.fn(), + } ), +} ) ); +jest.mock( '../../../hooks/use-analytics', () => ( { + __esModule: true, + default: () => ( { recordEvent: jest.fn() } ), +} ) ); +jest.mock( '../../module-toggle', () => ( { + ModuleToggle: ( { labelledby, disabled }: { labelledby?: string; disabled?: boolean } ) => ( + + ), +} ) ); + +const build = ( overrides: Partial< MyJetpackModule > = {} ) => + ( { + module: 'markdown', + name: 'Markdown', + activated: true, + override: false, + options: { + wpcom_publish_posts_with_markdown: { current_value: true }, + wpcom_publish_comments_with_markdown: { current_value: false }, + }, + ...overrides, + } ) as unknown as MyJetpackModule; + +const postsSwitch = () => screen.getByRole( 'switch', { name: /posts and pages/ } ); +const commentsSwitch = () => screen.getByRole( 'switch', { name: /comments/ } ); + +beforeEach( () => { + jest.clearAllMocks(); + ( apiFetch as unknown as jest.Mock ).mockResolvedValue( {} ); +} ); + +describe( 'MarkdownSettings', () => { + it( 'shows each option with its stored value', () => { + render( ); + + expect( postsSwitch() ).toBeChecked(); + expect( commentsSwitch() ).not.toBeChecked(); + } ); + + it( 'saves the comments option on its own', async () => { + render( ); + await userEvent.click( commentsSwitch() ); + + expect( apiFetch ).toHaveBeenCalledWith( { + path: '/jetpack/v4/settings', + method: 'POST', + data: { wpcom_publish_comments_with_markdown: true }, + } ); + } ); + + it.each( [ + [ 'the module is off', { activated: false }, false ], + [ 'the site cannot use it', {}, true ], + ] )( 'locks both options when %s', ( _name, overrides, disabled ) => { + render( ); + + expect( postsSwitch() ).toHaveAttribute( 'aria-disabled', 'true' ); + expect( commentsSwitch() ).toHaveAttribute( 'aria-disabled', 'true' ); + } ); + + it( 'locks the module switch when the site cannot use it', () => { + render( ); + + expect( screen.getByRole( 'checkbox', { name: 'Enable Markdown' } ) ).toBeDisabled(); + } ); +} ); diff --git a/projects/packages/my-jetpack/changelog/change-settings-markdown-panel b/projects/packages/my-jetpack/changelog/change-settings-markdown-panel new file mode 100644 index 000000000000..5d717b2e998a --- /dev/null +++ b/projects/packages/my-jetpack/changelog/change-settings-markdown-panel @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Settings panel: Add the Markdown settings, behind the settings consolidation flag. + + diff --git a/projects/packages/my-jetpack/src/class-initializer.php b/projects/packages/my-jetpack/src/class-initializer.php index 1bb5a2164756..2d726b8b241b 100644 --- a/projects/packages/my-jetpack/src/class-initializer.php +++ b/projects/packages/my-jetpack/src/class-initializer.php @@ -155,7 +155,7 @@ class Initializer { /** * Modules whose Jetpack settings link opens in the Features panel. A subset of `moduleSettings` in `settings-panel/registry.ts`; see there for which modules stay out. */ - public const SETTINGS_PANEL_MODULES = array( 'carousel', 'infinite-scroll', 'post-by-email', 'related-posts' ); + public const SETTINGS_PANEL_MODULES = array( 'carousel', 'infinite-scroll', 'markdown', 'post-by-email', 'related-posts' ); /** * Holds info/data about the site (from the /sites/%d endpoint) diff --git a/projects/plugins/jetpack/_inc/client/discussion/index.jsx b/projects/plugins/jetpack/_inc/client/discussion/index.jsx index c8fe94f405ac..e4b6eab67867 100644 --- a/projects/plugins/jetpack/_inc/client/discussion/index.jsx +++ b/projects/plugins/jetpack/_inc/client/discussion/index.jsx @@ -2,6 +2,7 @@ import { __ } from '@wordpress/i18n'; import { Component } from 'react'; import { connect } from 'react-redux'; import QuerySite from 'components/data/query-site'; +import { isSettingsConsolidationEnabled } from 'lib/settings-consolidation'; import { isOfflineMode, isUnavailableInOfflineMode, @@ -12,6 +13,7 @@ import { isOdysseyStatsEnabled, getSiteAdminUrl, isCommentBlocksAvailable, + userCanManageModules, } from 'state/initial-state'; import { getModule, getModuleOverride } from 'state/modules'; import { isModuleFound as _isModuleFound } from 'state/search'; @@ -68,7 +70,13 @@ export default connect( state => { settings: getSettings( state ), isOfflineMode: isOfflineMode( state ), isUnavailableInOfflineMode: module_name => isUnavailableInOfflineMode( state, module_name ), - isModuleFound: module_name => _isModuleFound( state, module_name ), + // Markdown's settings live in its My Jetpack panel, as in the Writing tab. + isModuleFound: module_name => + ! ( + 'markdown' === module_name && + isSettingsConsolidationEnabled() && + userCanManageModules( state ) + ) && _isModuleFound( state, module_name ), connectUrl: getConnectUrl( state ), isLinked: isCurrentUserLinked( state ), getModuleOverride: module_name => getModuleOverride( state, module_name ), diff --git a/projects/plugins/jetpack/_inc/client/writing/composing.jsx b/projects/plugins/jetpack/_inc/client/writing/composing.jsx index 56e8360d5642..6af51f13f479 100644 --- a/projects/plugins/jetpack/_inc/client/writing/composing.jsx +++ b/projects/plugins/jetpack/_inc/client/writing/composing.jsx @@ -11,10 +11,14 @@ import { ModuleToggle } from 'components/module-toggle'; import { FeaturesPointer } from 'components/pointer-card'; import SettingsCard from 'components/settings-card'; import SettingsGroup from 'components/settings-group'; -import { isSwitchedInFeatures as _isSwitchedInFeatures } from 'lib/settings-consolidation'; -import { showMyJetpack } from 'state/initial-state'; +import { + isSettingsConsolidationEnabled, + isSwitchedInFeatures as _isSwitchedInFeatures, +} from 'lib/settings-consolidation'; +import { showMyJetpack, userCanManageModules } from 'state/initial-state'; import { getModule } from 'state/modules'; import { isModuleFound as _isModuleFound, getSearchTerm } from 'state/search'; +import { MarkdownMoved } from './markdown-moved'; // Card order. const COMPOSING_MODULES = [ 'copy-post', 'markdown', 'latex', 'shortcodes', 'blocks' ]; @@ -49,11 +53,12 @@ export class Composing extends Component { }; render() { - const { isModuleFound, isSwitchedInFeatures } = this.props, + const { isMarkdownMoved, isModuleFound, isSwitchedInFeatures } = this.props, isFound = module => ! isSwitchedInFeatures( module ) && isModuleFound( module ), foundCopyPost = isFound( 'copy-post' ), foundLatex = isFound( 'latex' ), - foundMarkdown = isFound( 'markdown' ), + foundMarkdown = ! isMarkdownMoved && isFound( 'markdown' ), + pointsToMarkdown = isMarkdownMoved && !! this.props.searchTerm && isModuleFound( 'markdown' ), foundShortcodes = isFound( 'shortcodes' ), foundBlocks = isFound( 'blocks' ), foundMyJetpack = this.props.isMyJetpackReachable, @@ -64,7 +69,7 @@ export class Composing extends Component { ) : []; - if ( ! foundCard && ! pointedModules.length ) { + if ( ! foundCard && ! pointedModules.length && ! pointsToMarkdown ) { return null; } @@ -262,6 +267,7 @@ export class Composing extends Component { /> ); } ) } + { pointsToMarkdown && } ); } @@ -272,6 +278,8 @@ export default connect( state => { module: module_name => getModule( state, module_name ), isModuleFound: module_name => _isModuleFound( state, module_name ), isSwitchedInFeatures: module_name => _isSwitchedInFeatures( state, module_name ), + // The panel needs Features, which users who cannot manage modules lack. + isMarkdownMoved: isSettingsConsolidationEnabled() && userCanManageModules( state ), isMyJetpackReachable: showMyJetpack( state ), searchTerm: getSearchTerm( state ), }; diff --git a/projects/plugins/jetpack/_inc/client/writing/markdown-moved.jsx b/projects/plugins/jetpack/_inc/client/writing/markdown-moved.jsx new file mode 100644 index 000000000000..27a1003da941 --- /dev/null +++ b/projects/plugins/jetpack/_inc/client/writing/markdown-moved.jsx @@ -0,0 +1,19 @@ +import { __ } from '@wordpress/i18n'; +import PointerCard from 'components/pointer-card'; + +/** + * Search result that sends the Markdown settings to the panel in Features. + * + * @param {object} props - Component props. + * @param {Function} props.getModule - Reads a module by slug. + * @return {import('react').ReactNode} The card. + */ +export const MarkdownMoved = ( { getModule } ) => ( + +

{ __( 'The Markdown settings are now in Features, in My Jetpack.', 'jetpack' ) }

+
+); diff --git a/projects/plugins/jetpack/_inc/client/writing/test/composing.test.jsx b/projects/plugins/jetpack/_inc/client/writing/test/composing.test.jsx index 8af98d11012d..4a4b417d5946 100644 --- a/projects/plugins/jetpack/_inc/client/writing/test/composing.test.jsx +++ b/projects/plugins/jetpack/_inc/client/writing/test/composing.test.jsx @@ -14,6 +14,9 @@ jest.mock( 'components/module-toggle', () => ( { jest.mock( 'components/pointer-card', () => ( { FeaturesPointer: ( { search } ) =>
{ `Features pointer: ${ search }` }
, } ) ); +jest.mock( '../markdown-moved', () => ( { + MarkdownMoved: () =>
markdown panel pointer
, +} ) ); jest.mock( 'components/settings-card', () => ( { __esModule: true, default: ( { children } ) => children, @@ -49,7 +52,11 @@ const buildState = ( canManageModules, searchTerm ) => ( { const shownToggles = () => MODULES.filter( module => screen.queryByText( `${ module } toggle` ) ); const shownPointers = () => - MODULES.filter( module => screen.queryByText( `Features pointer: ${ NAMES[ module ] }` ) ); + MODULES.filter( + module => + screen.queryByText( `Features pointer: ${ NAMES[ module ] }` ) || + screen.queryByText( `${ module } panel pointer` ) + ); describe( 'Composing', () => { afterEach( () => { @@ -58,7 +65,7 @@ describe( 'Composing', () => { it.each( [ [ 'every toggle while the settings flag is off', false, true, '', MODULES, [] ], - [ 'only Markdown once Features switches the rest', true, true, '', [ 'markdown' ], [] ], + [ 'no toggle once the settings move out', true, true, '', [], [] ], [ 'a pointer to Features for a search once the flag is on', true, @@ -67,6 +74,14 @@ describe( 'Composing', () => { [], [ 'latex' ], ], + [ + 'a pointer to the panel for a Markdown search once the flag is on', + true, + true, + 'markdown', + [], + [ 'markdown' ], + ], [ 'every toggle to users who cannot manage modules', true, false, '', MODULES, [] ], ] )( 'shows %s', ( _label, flag, canManageModules, searchTerm, toggles, pointers ) => { window.JetpackScriptData = { diff --git a/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json b/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json index f944033332d4..6e32123aa0d3 100644 --- a/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json +++ b/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json @@ -2,7 +2,7 @@ "description": "Where each Jetpack Settings hash route and ?term= search goes once the Settings screen retires. Nothing reads it yet: the redirect document that page=jetpack-settings and the page=jetpack forwarder (Jetpack_React_Page) will print resolves these rules in PHP, since the server never sees the hash. It applies only while Initializer::is_settings_consolidation_enabled() is true. The Network Admin jetpack-settings page is out of scope. It is production-excluded in .gitattributes; the PR that first reads it must remove that exclusion.", "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` is an open decision, `JETPACK-` an issue that must land, `flag:` 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.", "D7": "Where Google Analytics settings go on Atomic (the SEO page, or Stats settings).", "D9": "Where users who cannot manage modules find Post by Email, Publicize and their own account connection, since Features needs manage_options.", "D10": "What happens to the legacy SEO block on self-hosted sites that have not opted in to the SEO page.", @@ -97,7 +97,7 @@ "source": "/writing", "rules": [ { "when": { "canManageModules": false }, "pending": [ "D9" ] }, - { "pending": [ "D2" ] } + { "destination": "admin.php?page=my-jetpack#/features" } ], "linkedFrom": [ "plugins/jetpack Unavailable_Blocks::get_editor_data(): fixUrl for blocks the Blocks module turned off; wants admin.php?page=my-jetpack#/features?search=blocks", @@ -303,7 +303,12 @@ ] }, { "source": "comments", "rules": [ { "pending": [ "D2" ] } ] }, - { "source": "markdown", "rules": [ { "pending": [ "D2" ] } ] }, + { + "source": "markdown", + "rules": [ + { "destination": "admin.php?page=my-jetpack&p=%2Ffeatures%3Fconfigure%3Dmarkdown" } + ] + }, { "source": "gravatar-hovercards", "rules": [ { "pending": [ "D2" ] } ] }, { "source": "custom-content-types", diff --git a/projects/plugins/jetpack/changelog/change-settings-markdown-panel b/projects/plugins/jetpack/changelog/change-settings-markdown-panel new file mode 100644 index 000000000000..f9638aa49ee7 --- /dev/null +++ b/projects/plugins/jetpack/changelog/change-settings-markdown-panel @@ -0,0 +1,5 @@ +Significance: patch +Type: enhancement +Comment: Settings: Point the Markdown settings to their panel in My Jetpack, behind the settings consolidation flag. + + From c11ed673528561369f6ef9c3ddc9b1fc3558da8d Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Thu, 12 Nov 2026 16:43:33 -0300 Subject: [PATCH 2/4] Settings: Hide the emptied Writing tab for admins With settings consolidation on, every Writing card has moved, so admins get no Writing tab and #/writing opens Features. --- .../components/settings-nav-tabs/index.jsx | 20 +++++-------------- .../settings-nav-tabs/test/component.jsx | 4 ++++ projects/plugins/jetpack/_inc/client/main.jsx | 8 +++++++- .../_inc/client/test/security-route.test.jsx | 3 ++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/index.jsx b/projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/index.jsx index 6149996a5bdb..6dd249ae3984 100644 --- a/projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/index.jsx +++ b/projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/index.jsx @@ -7,11 +7,7 @@ import { useLocation, useNavigate } from 'react-router'; import QuerySitePlugins from 'components/data/query-site-plugins'; import Search from 'components/search'; import analytics from 'lib/analytics'; -import { - getAdsSettingsUrl, - isSettingsConsolidationEnabled, - isSwitchedInFeatures as _isSwitchedInFeatures, -} from 'lib/settings-consolidation'; +import { getAdsSettingsUrl, isSettingsConsolidationEnabled } from 'lib/settings-consolidation'; import { userCanManageModules as _userCanManageModules, userIsSubscriber as _userIsSubscriber, @@ -56,7 +52,6 @@ const SettingsNavTabs = props => { hasPerformanceFeature, hasModules, isModuleActive, - isSwitchedInFeatures, searchTerm, searchForTerm, } = props; @@ -113,15 +108,11 @@ const SettingsNavTabs = props => { if ( ! isSettingsConsolidationEnabled() && hasPerformanceFeature ) { visibleTabs.push( '/performance' ); } - // A module Features switches no longer fills this tab. + // Once settings move out, every Writing card has a new home and leaves only a search pointer here. if ( - hasModules( - [ 'markdown', 'post-by-email', 'infinite-scroll', 'copy-post' ].filter( - module => ! isSwitchedInFeatures( module ) - ) - ) || - // Once settings move out, custom content types leave only a search pointer here. - ( ! isSettingsConsolidationEnabled() && window.CUSTOM_CONTENT_TYPE__INITIAL_STATE?.active ) + ! isSettingsConsolidationEnabled() && + ( hasModules( [ 'markdown', 'post-by-email', 'infinite-scroll', 'copy-post' ] ) || + window.CUSTOM_CONTENT_TYPE__INITIAL_STATE?.active ) ) { visibleTabs.push( '/writing' ); } @@ -231,7 +222,6 @@ export default connect( hasPerformanceFeature: hasAnyPerformanceFeature( state ), hasModules: modules => hasAnyOfTheseModules( state, modules ), isModuleActive: module => isModuleActivated( state, module ), - isSwitchedInFeatures: module => _isSwitchedInFeatures( state, module ), searchTerm: getSearchTerm( state ), } ), dispatch => ( { diff --git a/projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/test/component.jsx b/projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/test/component.jsx index ebeda1d586e9..7b0afc4d66e8 100644 --- a/projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/test/component.jsx +++ b/projects/plugins/jetpack/_inc/client/components/settings-nav-tabs/test/component.jsx @@ -95,6 +95,10 @@ describe( 'SettingsNavTabs', () => { [ 'shows', 'Sharing', 'Like buttons', 'likes', false, 1 ], [ 'shows', 'Writing', 'Copy Post', 'copy-post', false, 1 ], [ 'hides', 'Writing', 'Copy Post', 'copy-post', true, 0 ], + [ 'shows', 'Writing', 'Markdown', 'markdown', false, 1 ], + [ 'hides', 'Writing', 'Markdown', 'markdown', true, 0 ], + [ 'hides', 'Writing', 'Post by Email', 'post-by-email', true, 0 ], + [ 'hides', 'Writing', 'Infinite Scroll', 'infinite-scroll', true, 0 ], [ 'shows', 'Writing', 'custom content types', null, false, 1 ], [ 'hides', 'Writing', 'custom content types', null, true, 0 ], [ 'shows', 'Reader', 'the Reader', 'wpcom-reader', false, 1 ], diff --git a/projects/plugins/jetpack/_inc/client/main.jsx b/projects/plugins/jetpack/_inc/client/main.jsx index eb3a1fcd4925..2a0ea075c45b 100644 --- a/projects/plugins/jetpack/_inc/client/main.jsx +++ b/projects/plugins/jetpack/_inc/client/main.jsx @@ -284,8 +284,14 @@ export class Main extends Component { break; } // Falls through. - case '/settings': case '/writing': + // Only admins get here, and they find every Writing setting in Features once settings move out. + if ( '/writing' === route && isSettingsConsolidationEnabled() ) { + window.location.replace( getAdminUrl( 'admin.php?page=my-jetpack#/features' ) ); + break; + } + // Falls through. + case '/settings': case '/discussion': case '/traffic': case '/privacy': diff --git a/projects/plugins/jetpack/_inc/client/test/security-route.test.jsx b/projects/plugins/jetpack/_inc/client/test/security-route.test.jsx index 0a076832b27b..bf175d0078cd 100644 --- a/projects/plugins/jetpack/_inc/client/test/security-route.test.jsx +++ b/projects/plugins/jetpack/_inc/client/test/security-route.test.jsx @@ -78,6 +78,7 @@ describe( 'Main routes that leave Settings once settings move out', () => { [ '/performance', 'admin.php?page=my-jetpack#/features?search=cdn' ], [ '/sharing', 'admin.php?page=my-jetpack#/features?search=sharing' ], [ '/reader', 'admin.php?page=my-jetpack#/features?search=reader' ], + [ '/writing', 'admin.php?page=my-jetpack#/features' ], ] )( 'sends %s to %s with the settings flag on', ( route, destination ) => { isSettingsConsolidationEnabled.mockReturnValue( true ); renderAt( route, false ); @@ -87,7 +88,7 @@ describe( 'Main routes that leave Settings once settings move out', () => { expect( screen.queryByTestId( 'searchable-settings' ) ).not.toBeInTheDocument(); } ); - it.each( [ '/performance', '/sharing', '/reader' ] )( + it.each( [ '/performance', '/sharing', '/reader', '/writing' ] )( 'keeps %s on Settings with the settings flag off', route => { renderAt( route, false ); From 256d554d87db7ee05d7b73f82d824cdba88ba4cd Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Thu, 12 Nov 2026 18:26:26 -0300 Subject: [PATCH 3/4] Settings: Mark the Comments map entries as waiting on JETPACK-3720 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 --- .../_inc/lib/admin-pages/settings-redirect-map.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json b/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json index 6e32123aa0d3..129e20fd4948 100644 --- a/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json +++ b/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json @@ -2,7 +2,6 @@ "description": "Where each Jetpack Settings hash route and ?term= search goes once the Settings screen retires. Nothing reads it yet: the redirect document that page=jetpack-settings and the page=jetpack forwarder (Jetpack_React_Page) will print resolves these rules in PHP, since the server never sees the hash. It applies only while Initializer::is_settings_consolidation_enabled() is true. The Network Admin jetpack-settings page is out of scope. It is production-excluded in .gitattributes; the PR that first reads it must remove that exclusion.", "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` is an open decision, `JETPACK-` an issue that must land, `flag:` 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) get one settings panel or become Features switches.", "D7": "Where Google Analytics settings go on Atomic (the SEO page, or Stats settings).", "D9": "Where users who cannot manage modules find Post by Email, Publicize and their own account connection, since Features needs manage_options.", "D10": "What happens to the legacy SEO block on self-hosted sites that have not opted in to the SEO page.", @@ -133,7 +132,7 @@ }, { "source": "/discussion", - "rules": [ { "pending": [ "D2" ] } ], + "rules": [ { "pending": [ "JETPACK-3720" ] } ], "outsideRepo": [ "wpcom: help search key" ] }, { @@ -302,14 +301,14 @@ { "destination": "admin.php?page=my-jetpack&p=%2Ffeatures%3Fconfigure%3Dpost-by-email" } ] }, - { "source": "comments", "rules": [ { "pending": [ "D2" ] } ] }, + { "source": "comments", "rules": [ { "pending": [ "JETPACK-3720" ] } ] }, { "source": "markdown", "rules": [ { "destination": "admin.php?page=my-jetpack&p=%2Ffeatures%3Fconfigure%3Dmarkdown" } ] }, - { "source": "gravatar-hovercards", "rules": [ { "pending": [ "D2" ] } ] }, + { "source": "gravatar-hovercards", "rules": [ { "pending": [ "JETPACK-3720" ] } ] }, { "source": "custom-content-types", "rules": [ { "destination": "options-writing.php#cpt-options" } ] From b9ec10855b1f5d3facbd34ed395075037ee0092a Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Thu, 12 Nov 2026 19:38:45 -0300 Subject: [PATCH 4/4] Settings: Complete the /writing and /performance map rules /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 --- .../jetpack/_inc/lib/admin-pages/settings-redirect-map.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json b/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json index 129e20fd4948..f7d69f5a5fff 100644 --- a/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json +++ b/projects/plugins/jetpack/_inc/lib/admin-pages/settings-redirect-map.json @@ -78,6 +78,7 @@ { "source": "/performance", "rules": [ + { "when": { "canManageModules": false }, "pending": [ "D9" ] }, { "destination": "admin.php?page=my-jetpack#/features?search=cdn", "alreadyRedirects": true @@ -96,7 +97,7 @@ "source": "/writing", "rules": [ { "when": { "canManageModules": false }, "pending": [ "D9" ] }, - { "destination": "admin.php?page=my-jetpack#/features" } + { "destination": "admin.php?page=my-jetpack#/features", "alreadyRedirects": true } ], "linkedFrom": [ "plugins/jetpack Unavailable_Blocks::get_editor_data(): fixUrl for blocks the Blocks module turned off; wants admin.php?page=my-jetpack#/features?search=blocks",