fix: Avoid re-transcoding virtual media and Vimeo videos#1054
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the retranscoding functionality to properly handle virtual media and migrated Vimeo videos by skipping their retranscoding and displaying appropriate warning messages to users.
- Added detection for virtual media (from GoDAM Central) and migrated Vimeo videos in the backend API
- Enhanced frontend to track and display warnings for skipped virtual media files
- Improved message composition logic to handle multiple notification types (success, failure, warnings)
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| pages/tools/components/tabs/RetranscodeTab.jsx | Added virtual media counting, improved message handling, and enhanced notification logic |
| inc/classes/rest-api/class-transcoding.php | Added checks for virtual media and migrated Vimeo videos with appropriate skip responses |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ); | ||
|
|
||
| return new \WP_REST_Response( | ||
| array( |
There was a problem hiding this comment.
[nitpick] Inconsistent array formatting - there's an extra space after the opening parenthesis in lines 393 and 414, but not in line 464. For consistency, remove the extra spaces.
| ); | ||
|
|
||
| return new \WP_REST_Response( | ||
| array( |
There was a problem hiding this comment.
[nitpick] Inconsistent array formatting - there's an extra space after the opening parenthesis in lines 393 and 414, but not in line 464. For consistency, remove the extra spaces.
|
|
||
| return new \WP_REST_Response( | ||
| array( 'message' => $message ), | ||
| array( |
There was a problem hiding this comment.
[nitpick] Inconsistent array formatting - there's an extra space after the opening parenthesis in lines 393 and 414, but not in line 464. For consistency, remove the extra spaces.
| if ( data.skipped === true ) { | ||
| if ( data.reason === 'virtual_media' || data.reason === 'migrated_vimeo' ) { | ||
| setVirtualMediaCount( ( prevCount ) => prevCount + 1 ); | ||
| } | ||
| } else if ( data.skipped === false && data.sent === true ) { |
There was a problem hiding this comment.
[nitpick] The boolean comparisons === true and === false are unnecessary. Use if ( data.skipped ) and else if ( !data.skipped && data.sent ) for cleaner code.
| if ( data.skipped === true ) { | |
| if ( data.reason === 'virtual_media' || data.reason === 'migrated_vimeo' ) { | |
| setVirtualMediaCount( ( prevCount ) => prevCount + 1 ); | |
| } | |
| } else if ( data.skipped === false && data.sent === true ) { | |
| if ( data.skipped ) { | |
| if ( data.reason === 'virtual_media' || data.reason === 'migrated_vimeo' ) { | |
| setVirtualMediaCount( ( prevCount ) => prevCount + 1 ); | |
| } | |
| } else if ( !data.skipped && data.sent ) { |
| if ( data.skipped === true ) { | ||
| if ( data.reason === 'virtual_media' || data.reason === 'migrated_vimeo' ) { | ||
| setVirtualMediaCount( ( prevCount ) => prevCount + 1 ); | ||
| } | ||
| } else if ( data.skipped === false && data.sent === true ) { |
There was a problem hiding this comment.
[nitpick] The boolean comparisons === true and === false are unnecessary. Use if ( data.skipped ) and else if ( !data.skipped && data.sent ) for cleaner code.
| if ( data.skipped === true ) { | |
| if ( data.reason === 'virtual_media' || data.reason === 'migrated_vimeo' ) { | |
| setVirtualMediaCount( ( prevCount ) => prevCount + 1 ); | |
| } | |
| } else if ( data.skipped === false && data.sent === true ) { | |
| if ( data.skipped ) { | |
| if ( data.reason === 'virtual_media' || data.reason === 'migrated_vimeo' ) { | |
| setVirtualMediaCount( ( prevCount ) => prevCount + 1 ); | |
| } | |
| } else if ( !data.skipped && data.sent ) { |
Screenshot