Skip to content

VideoPress: Only intercept video uploads when VideoPress is available#46894

Open
obenland wants to merge 3 commits intotrunkfrom
fix/videopress-block-forced-when-disabled
Open

VideoPress: Only intercept video uploads when VideoPress is available#46894
obenland wants to merge 3 commits intotrunkfrom
fix/videopress-block-forced-when-disabled

Conversation

@obenland
Copy link
Member

@obenland obenland commented Feb 2, 2026

Fixes #44891
Fixes VIDP-42

Proposed changes:

  • Add a canUploadToVideoPress flag to the block editor state that determines whether VideoPress should handle video file uploads
  • On Dotcom sites (simple/atomic): always true (VideoPress shows appropriate errors/upsell if no plan)
  • On Jetpack sites: true only if VideoPress is active AND (user has plan OR free video available)
  • Update the VideoPress block's file transform to check this flag before intercepting video uploads
  • When the flag is false on Jetpack sites, the core/video block handles the upload to the local server instead

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

N/A

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

No

Testing instructions:

Self-hosted Jetpack site with VideoPress module disabled:

  1. Install Jetpack on a self-hosted WordPress site
  2. Disable the VideoPress module in Jetpack → Settings → Performance
  3. Create a new post
  4. Drag a video file (MP4, MOV, etc.) into the editor
  5. Expected: A core/video block is created and the video uploads to your local server
  6. Before fix: A VideoPress block was created and the upload failed with "Enable Jetpack module to continue using VideoPress"

Self-hosted Jetpack site with VideoPress enabled but no plan (after using free video):

  1. Enable VideoPress module
  2. Upload one video (uses free video)
  3. Drag another video file into the editor
  4. Expected: A core/video block is created
  5. Before fix: A VideoPress block was created and failed with quota error

Self-hosted Jetpack site with VideoPress enabled and plan:

  1. Enable VideoPress module on a site with VideoPress plan
  2. Drag a video file into the editor
  3. Expected: A VideoPress block is created and upload succeeds

WordPress.com site:

  1. On a WordPress.com site (any plan)
  2. Drag a video file into the editor
  3. Expected: A VideoPress block is created (shows appropriate error/upsell if no plan)

When a user drags a video file into the block editor, the VideoPress
block was intercepting the upload even when VideoPress was disabled or
the user couldn't upload to VideoPress. This resulted in confusing error
messages instead of the expected core/video block behavior.

This fix adds a `canUploadToVideoPress` flag that checks:
- On Dotcom sites (simple/atomic): always true (VideoPress handles uploads)
- On Jetpack sites: VideoPress must be active AND (user has plan OR free video available)

When the flag is false on Jetpack sites, the core/video block handles
the upload to the local server instead.

Fixes #44891
@obenland obenland added [Type] Bug When a feature is broken and / or not performing as intended [Feature] VideoPress A feature to help you upload and insert videos on your site. [Status] Needs Review This PR is ready for review. labels Feb 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

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!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

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 fix/videopress-block-forced-when-disabled branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/videopress-block-forced-when-disabled

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

- Add PHP tests for can_upload_to_videopress() Dotcom behavior
- Add JS tests for canUploadToVideoPress check in transformFromFile.isMatch()
- Fix plan check to use 'videopress-1tb-storage' feature
@jp-launch-control
Copy link

jp-launch-control bot commented Feb 2, 2026

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/videopress/src/class-block-editor-extensions.php 4/66 (6.06%) 6.06% 5 💔
projects/packages/videopress/src/client/block-editor/blocks/video/transforms/index.tsx 20/57 (35.09%) 3.61% 0 💚
projects/packages/videopress/src/class-status.php 3/6 (50.00%) 50.00% -3 💚

Full summary · PHP report · JS report

Coverage check overridden by I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. .

@obenland obenland added the I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. label Feb 2, 2026
@obenland obenland self-assigned this Feb 5, 2026
@obenland obenland marked this pull request as ready for review February 5, 2026 13:10
Copilot AI review requested due to automatic review settings February 5, 2026 13:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where the VideoPress block was forcibly inserted when dragging video files into the editor, even when VideoPress was disabled or unavailable on Jetpack sites. The fix introduces a new flag that determines whether VideoPress should intercept video uploads.

Changes:

  • Adds a canUploadToVideoPress flag to the block editor state that controls whether VideoPress handles video uploads
  • Implements logic to determine upload eligibility: always enabled on Dotcom sites, conditionally enabled on Jetpack sites based on VideoPress status and plan/quota availability
  • Updates the VideoPress block's file transform to check the flag before intercepting uploads, allowing core/video to handle uploads when VideoPress is unavailable

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
projects/packages/videopress/src/class-block-editor-extensions.php Adds the can_upload_to_videopress() method that determines upload eligibility based on site type, VideoPress status, plan support, and free video availability; exposes this as canUploadToVideoPress in the editor state
projects/packages/videopress/src/client/block-editor/global.d.ts Adds TypeScript type definition for canUploadToVideoPress as '' | '1' to match WordPress localization pattern
projects/packages/videopress/src/client/block-editor/blocks/video/transforms/index.tsx Updates the file transform's isMatch method to check the canUploadToVideoPress flag before intercepting video uploads
projects/packages/videopress/src/client/block-editor/blocks/video/transforms/test/index.tsx Adds comprehensive test coverage for the new flag checking logic including edge cases
projects/packages/videopress/tests/php/Block_Editor_Extensions_Test.php Adds PHP unit tests for the can_upload_to_videopress() method covering Dotcom and Jetpack scenarios
projects/packages/videopress/changelog/fix-videopress-block-forced-when-disabled Adds changelog entry documenting the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] VideoPress A feature to help you upload and insert videos on your site. I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. [Package] VideoPress [Status] In Progress [Status] Needs Review This PR is ready for review. [Tests] Includes Tests [Type] Bug When a feature is broken and / or not performing as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VideoPress block forced in editor despite being disabled

1 participant