VideoPress: add a site-level setting to disable auto-generated captions#50014
VideoPress: add a site-level setting to disable auto-generated captions#50014obenland wants to merge 4 commits into
Conversation
Adds an opt-out for auto-generated captions in the new DataViews-based VideoPress settings UI. Auto-captions remain on by default; the site owner can turn them off via a new "Captions" card. Modeled as an opt-out flag (videopress_auto_generated_captions_disabled, default false) so the value persists reliably even on a fresh site — update_option() short-circuits when writing false to an absent option, so an "enabled, default true" model could never store the off state. The option is synced to WordPress.com so the caption-generation pipeline can honor it (see PR description for the required wpcom-side change). VIDP-263 Claude-Session: https://claude.ai/code/session_01K4JTgKPiD3XYk9CKb19Zoa
|
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.
|
The settings form had two near-identical Card.Root/ToggleControl blocks. Extract a local SettingCard component so each setting is a few props instead of repeated card boilerplate. Claude-Session: https://claude.ai/code/session_01K4JTgKPiD3XYk9CKb19Zoa
Rename videopress_auto_generated_captions_disabled to videopress_auto_subtitles_disabled throughout, including the PHP getter, REST param, TS hook fields, UI copy, comments, and changelog entries. Claude-Session: https://claude.ai/code/session_01K4JTgKPiD3XYk9CKb19Zoa
Cover update_settings and get_settings for the VideoPress settings endpoint, including the auto-subtitles option branches flagged as uncovered by the coverage report. Claude-Session: https://claude.ai/code/session_01K4JTgKPiD3XYk9CKb19Zoa
Fixes VIDP-263
Proposed changes
Adds a site-level opt-out for auto-generated captions. Since auto-subtitle generation shipped for all uploads, there has been no customer-facing way to turn it off — only per-video removal via the block's Text Tracks tool. This adds a "Captions" toggle so a site owner can disable auto-caption generation for all new videos at once.
routes/settings/stage.tsx) with an "Automatically generate captions for new videos" toggle. The toggle is on by default (captions stay enabled unless explicitly turned off). Not added to the legacy Jetpack admin settings UI.videopress_auto_generated_captions_disabled(boolean, defaultfalse), exposed and updated through the existingvideopress/v1/settingsREST endpoint.Why an opt-out flag (
_disabled) rather than an "enabled" flagModeled as a
*_disabledflag defaulting tofalse(matching the existingvideopress_private_enabled_for_sitepattern) so the value persists reliably.update_option()short-circuits when the new value equals the stored value, and an absent option reads asfalse— so a "default-true / enabled" model could never persist the off state on a fresh site. The opt-out framing avoids that entirely; the UI inverts it back to a positive "captions on" toggle for the user.While here, the REST
argswere cleaned up to rely on the schema (type => boolean) for sanitization viaget_param(), dropping the redundant explicitsanitize_callback/requiredand the manualboolval().Required WordPress.com-side change (separate PR in
contexta8c)This Jetpack PR stores and syncs the option but does not (and cannot) change caption generation, which runs on WordPress.com infrastructure. The wpcom side needs:
videopress_auto_generated_captions_disabledto WPcom's shadow replicastore options allowlist. Sync only sends the option once it's allowlisted here; WPcom independently filters what it retains, so without the wpcom-side entry the value arrives but is dropped.videopress_auto_generated_captions_disabledoption and skip generation when it is truthy.update_option()directly on the wpcom blog, so the pipeline reads it from the same blog options.Scope here is intentionally the opt-out for new uploads; bulk-clearing existing auto-generated tracks (also mentioned in the ticket) is out of scope for this PR.
Does this pull request change what data or activity we track or use?
No new tracking. It adds one synced boolean site option (
videopress_auto_generated_captions_disabled).Testing instructions
wp option get videopress_auto_generated_captions_disabledreturns1).0/false.jetpack test php packages/videopress(Data + settings coverage) andjetpack jest packages/videopress --testPathPattern use-settingspass.