Repository navigation
VideoPress: add a site-wide playlist index option - #52729
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. 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. |
Code Coverage SummaryCoverage changed in 4 files.
2 files are newly checked for coverage.
|
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
videopress_playlist_indexoption, maintained by a newPlaylist_Indexclass. It is an object keyed by a unique playlist key; each record holds the playlisttitle,description,videos(the same sanitized entries the playlist block renders) and thepost_idit lives in (needed to replace or drop a post's records when it is edited, unpublished or deleted). The option is stored without autoload.wp:videopress/playlistin batches of 100 and writes the option once. BumpingINDEX_VERSIONtriggers a rescan on every site.wp_after_insert_postre-indexes the saved post (revisions and autosaves are ignored; non-published posts drop out), anddeleted_postremoves its records.playlistId,playlistTitleandplaylistDescriptionattributes. A new "Playlist details" panel in the sidebar sets the title and description.playlistIdis 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:
core/blockrefs) are not expanded by the index scan, so a playlist that only exists inside a pattern is not listed.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(newPlaylist_Index_Test),jp test js packages/videopress,jp phan packages/videopress,pnpm run typecheckin 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):videopress_playlist_indexoption (wp option get videopress_playlist_index): it holds one record keyed by the block'splaylistId, with the title, description, videos and post id.videopress_playlist_index_version, load any wp-admin page, runwp 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