Skip to content

Commit

Permalink
Revert #33394 #33036 and #33042 - VP conditional asset enqueueing (#3…
Browse files Browse the repository at this point in the history
…3672)

* revert work on #33042 #33036 and #33394 as VP blocks on feeds (query loop) are not properly handled

* changelog

* fix versions
  • Loading branch information
CGastrell authored Oct 19, 2023
1 parent 23f8855 commit 6e657aa
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Revert changes on #33394 #33036 and #33042 - Those changes won't properly handle VP block assets on feeds/query loops
2 changes: 1 addition & 1 deletion projects/packages/videopress/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"link-template": "https://github.com/Automattic/jetpack-videopress/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "0.17.x-dev"
"dev-trunk": "0.18.x-dev"
},
"version-constants": {
"::PACKAGE_VERSION": "src/class-package-version.php"
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/videopress/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-videopress",
"version": "0.17.7-alpha",
"version": "0.18.0-alpha",
"description": "VideoPress package",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/videopress/#readme",
"bugs": {
Expand Down
31 changes: 0 additions & 31 deletions projects/packages/videopress/src/class-initializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,37 +364,6 @@ public static function register_videopress_video_block() {
return;
}

// check current theme
$is_block_theme = wp_get_theme()->is_block_theme();

// Check if the site is a P2 site
$is_p2_site = function_exists( '\WPForTeams\is_wpforteams_site' ) && \WPForTeams\is_wpforteams_site( get_current_blog_id() );

// for non block themes frontend, we defer the enqueuing to the frontend, so we're able to tell if we need the assets
// If site is p2, load the assets in the frontend
if ( ! $is_block_theme && ! is_admin() && ! $is_p2_site ) {
add_action(
'wp_enqueue_scripts',
function () use ( $videopress_video_metadata_file ) {
// There's been issues with get_the_content on plugins/libs that take an alternate process
// and do not get the globals needed for get_the_content to work.
// See: https://github.com/Automattic/jetpack/issues/33284
try {
$post_content = get_the_content();
} catch ( \TypeError $e ) {
return;
} catch ( \Exception $e ) {
return;
}

if ( ! empty( $post_content ) && ! has_block( 'videopress/video', $post_content ) && ! has_shortcode( $post_content, 'videopress' ) ) {
return;
}
self::enqueue_block_assets( $videopress_video_metadata_file );
}
);
return;
}
self::enqueue_block_assets( $videopress_video_metadata_file );
}

Expand Down
2 changes: 1 addition & 1 deletion projects/packages/videopress/src/class-package-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* The Package_Version class.
*/
class Package_Version {
const PACKAGE_VERSION = '0.17.7-alpha';
const PACKAGE_VERSION = '0.18.0-alpha';

const PACKAGE_SLUG = 'videopress';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/jetpack/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/videopress/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6e657aa

Please sign in to comment.