Podcast: dedicated jetpack/v4 settings endpoint#49567
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! |
Code Coverage SummaryCoverage changed in 3 files.
1 file is 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
|
Proposed changes
Move podcast site settings off core
/wp/v2/settings(and, on Simple, off the legacy WPCOM v1.x site-settings filters) onto a dedicated, package-owned REST endpoint. This unifies the schema/sanitizers in one place and makes the feature work unchanged on self-hosted Jetpack — it's purewp_optionsread/write with no wpcom backend.Podcast_Settings_Endpoint—jetpack/v4/podcast/settings,manage_optionsgated.GETreturns the full, stable-shape record viaSettings::get_all()(every option present; the two podcatcher maps padded to all directories).PUT/POST/PATCHapplies a partial patch: only keys present in the request are written, so absent keys can never clobber stored values. Array options merge on sanitize. Firesjetpack_podcast_settings_savedwhen an option is touched, then returns the full merged record.Settings— droppedshow_in_restfrom everyregister_setting()(defaults +sanitize_callbacks stay, soupdate_option()still merges/validates). Addedget_all(),rest_schema_properties(), andempty_podcatcher_map()helpers. Thepodcasting_*keys no longer appear in core/wp/v2/settings.Tracks— the aggregatewpcom_podcasting_settings_savedevent now fires off the newjetpack_podcast_settings_savedaction instead of hooking the/wp/v2/settingsREST response. The per-optionupdate_option_*Tracks hooks are transport-independent and unchanged.use-podcast-settings.ts) — reads/writes the new endpoint viaapiFetchwith a shared module-level cache. The exported contract ({ data, isLoading }/{ mutate, mutateAsync, isPending }) is unchanged, so all callers are untouched./wp/v2/settingsto the shared hook; for non-admin editors the fetch 403s and the cover resolves empty, identical to the prior behavior.A follow-up in the wpcom repo (separate PR, to land after this deploys) removes the now-duplicate v1.x mu-plugin and the podcasting assertions in the core settings-controller test.
Does this pull request change what data or activity we track or use?
No new tracking. The existing
wpcom_podcasting_settings_savedevent is unchanged (same properties, same PII redaction ofpodcasting_email/podcasting_talent_name); only its trigger moved to a package action.Testing instructions
GET jetpack/v4/podcast/settingsrequest returns the full padded record).podcasting_show_urls/podcasting_show_statespersist and pad to all directories on reload.GET /wp/v2/settingsno longer lists anypodcasting_*keys.projects/packages/podcast, runcomposer test-php(139 tests pass, incl. the newPodcast_Settings_Endpoint_Test).Verified locally:
composer test-php(139 tests / 339 assertions, green),php -l, andphpcson all changed files (clean). JS lint/type-check were not run locally (Node/pnpm toolchain mismatch in my env) and will be validated by CI.