Skip to content

Commit

Permalink
Fix token subscription service name (#34723)
Browse files Browse the repository at this point in the history
* Rename Token_Subscript_Service to Abstract_Token_Subscription_Service

* changelog

* Allow old class just in case

* `use` classes at the top to shorten up the class check.
  • Loading branch information
chrisfromthelc authored and sdixon194 committed Dec 20, 2023
1 parent d503ab9 commit 915d2f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Updated name of Abstract_Token_Subscription_Service
9 changes: 8 additions & 1 deletion projects/packages/videopress/src/class-access-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace Automattic\Jetpack\VideoPress;

use Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service\Abstract_Token_Subscription_Service;
use Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service\Token_Subscription_Service;
use Automattic\Jetpack\Modules;
use VIDEOPRESS_PRIVACY;

Expand Down Expand Up @@ -177,7 +179,12 @@ private function check_block_level_access( $restriction_details, $guid, $embedde
$paywall = \Automattic\Jetpack\Extensions\Premium_Content\subscription_service();

// Only paid subscribers should be granted access to the premium content.
$access_level = \Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service\Token_Subscription_Service::POST_ACCESS_LEVEL_PAID_SUBSCRIBERS;
if ( class_exists( Abstract_Token_Subscription_Service::class ) ) {
$access_level = Abstract_Token_Subscription_Service::POST_ACCESS_LEVEL_PAID_SUBSCRIBERS;
} else {
$access_level = Token_Subscription_Service::POST_ACCESS_LEVEL_PAID_SUBSCRIBERS;
}

$can_view = $paywall->visitor_can_view_content( array( $selected_plan_id ), $access_level );
$restriction_details['can_access'] = $can_view || current_user_can( 'edit_post', $embedded_post_id ); // Editors can always view the content.
}
Expand Down

0 comments on commit 915d2f1

Please sign in to comment.