Skip to content

VideoPress: add a site-wide playlist index option - #52729

Merged
heydemoura merged 1 commit into
trunkfrom
add/videopress-playlist-index-option
Sep 24, 2026
Merged

heydemoura merged 1 commit into
trunkfrom
add/videopress-playlist-index-option

Conversation

@heydemoura

Copy link
Copy Markdown
Contributor

First half of the All Playlists work, split out of #52724 so the option can ship on its own: this PR adds the site-wide playlist index and the playlist block settings that feed it. The All Playlists block that renders the index follows in #52724, stacked on this branch, once its design is ready.

Proposed changes

  • New videopress_playlist_index option, maintained by a new Playlist_Index class. It is an object keyed by a unique playlist key; each record holds the playlist title, description, videos (the same sanitized entries the playlist block renders) and the post_id it lives in (needed to replace or drop a post's records when it is edited, unpublished or deleted). The option is stored without autoload.
    • Initial population after the update: the first admin request on a site whose index version is behind schedules a one-off cron event that scans all published, public-post-type content containing wp:videopress/playlist in batches of 100 and writes the option once. Bumping INDEX_VERSION triggers a rescan on every site.
    • Incremental updates: wp_after_insert_post re-indexes the saved post (revisions and autosaves are ignored; non-published posts drop out), and deleted_post removes its records.
    • Only independent playlists are indexed. The Latest Videos Playlist block (VideoPress: add a Latest Videos Playlist block #52665) saves a Video Playlist block as its inner canvas; the scan skips that wrapper and everything inside it, so dynamic playlists never appear in the index.
  • Video Playlist block gains playlistId, playlistTitle and playlistDescription attributes. A new "Playlist details" panel in the sidebar sets the title and description. playlistId is assigned automatically when the block is inserted and regenerated when a duplicated block carries another block's id; it is the index key. Blocks saved before this change fall back to a {post id}-{ordinal} key until they are next saved, and a key already owned by another post (a block copied between posts) gets a -{post id} suffix.
  • Initializer::sanitize_playlist_entries() becomes public so the index stores the same entry shape the block renders.

Nothing reads the option yet. Out of scope, called out for follow-ups:

  • Synced patterns (core/block refs) are not expanded by the index scan, so a playlist that only exists inside a pattern is not listed.
  • The cron event depends on WP-Cron running.
  • The Video Playlist block does not render its own title and description yet; they only feed the index.

Related product discussion/links

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

No.

Testing instructions

Automated:

  • jp test php packages/videopress (new Playlist_Index_Test), jp test js packages/videopress, jp phan packages/videopress, pnpm run typecheck in the package, PHPCS and ESLint on the touched files all pass locally.

Manual (a site with VideoPress active and the package built with jp build packages/videopress):

  1. Insert a Video Playlist block in a post, add a couple of videos, fill in the new Playlist details title and description in the sidebar, and publish.
  2. Check the videopress_playlist_index option (wp option get videopress_playlist_index): it holds one record keyed by the block's playlistId, with the title, description, videos and post id.
  3. Duplicate the block in the editor: the copy gets its own id, and after publishing the option holds two records.
  4. Unpublish or delete the post and confirm its records disappear from the option.
  5. Add a Latest Videos Playlist block to a published post and confirm the option does not gain a record for it.
  6. Migration: on a site that already has published playlist blocks, delete videopress_playlist_index_version, load any wp-admin page, run wp cron event run videopress_build_playlist_index, and confirm the option lists every published playlist.

Not tested manually yet: WordPress.com Simple, and the cron scan on a large site.

🤖 Generated with Claude Code

@heydemoura heydemoura added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] VideoPress A feature to help you upload and insert videos on your site. [Status] In Progress labels Sep 23, 2026
@heydemoura heydemoura self-assigned this Sep 23, 2026
@github-actions

github-actions Bot commented Sep 23, 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 add/videopress-playlist-index-option branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/videopress-playlist-index-option

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 added [Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Tests] Includes Tests labels Sep 23, 2026
@github-actions

github-actions Bot commented Sep 23, 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: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Videopress plugin:

No scheduled milestone found for this plugin.

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 Sep 23, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 4 files.

File Coverage Δ% Δ Uncovered
projects/packages/videopress/src/client/block-editor/blocks/playlist/edit.tsx 150/154 (97.40%) -1.27% 2 ❤️‍🩹
projects/packages/videopress/src/class-initializer.php 446/502 (88.84%) 0.02% 0 💚
projects/packages/paypal-payments/src/paypal-payment-buttons/hooks/use-paypal-resource.js 50/51 (98.04%) 1.96% -1 💚
projects/packages/videopress/src/client/components/chapters-editor/preview/use-preview-playback.ts 128/148 (86.49%) 1.35% -2 💚

2 files are newly checked for coverage.

File Coverage
projects/packages/videopress/src/client/block-editor/blocks/playlist/use-playlist-id.ts 12/13 (92.31%) 💚
projects/packages/videopress/src/class-playlist-index.php 107/110 (97.27%) 💚

Full summary · PHP report · JS report

@heydemoura
heydemoura marked this pull request as ready for review September 23, 2026 18:43
@heydemoura
heydemoura requested a review from a team as a code owner September 23, 2026 18:43
@heydemoura
heydemoura merged commit d1aeb68 into trunk Sep 24, 2026
86 checks passed
@heydemoura
heydemoura deleted the add/videopress-playlist-index-option branch September 24, 2026 20:41
@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] In Progress labels Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] VideoPress A feature to help you upload and insert videos on your site. [Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

1 participant