← All changes
|
extensions/plugins/ai-assistant-plugin/reader-chat/class-jetpack-reader-chat.php
+8
-2
16.3-a.1
→
16.3-a.7
View file →
| @@ -17,8 +17,9 @@ | ||
| 17 | 17 | |
| 18 | 18 | namespace Automattic\Jetpack\Extensions\AiAssistantPlugin; |
| 19 | 19 | |
| 20 | 20 | use Automattic\Jetpack\Connection\Manager as Connection_Manager; |
| 21 | +use Automattic\Jetpack\Search\Helper as Search_Helper; | |
| 21 | 22 | use Automattic\Jetpack\Search\Plan; |
| 22 | 23 | use Automattic\Jetpack\Status; |
| 23 | 24 | use Automattic\Jetpack\Status\Host; |
| 24 | 25 | use Jetpack_Options; |
| @@ -439,9 +440,12 @@ | ||
| 439 | 440 | |
| 440 | 441 | $wpcom_plan_info_class = '\Jetpack\Search\Plan_Info'; |
| 441 | 442 | if ( class_exists( $wpcom_plan_info_class ) ) { |
| 442 | 443 | $plan_info = new $wpcom_plan_info_class( $blog_id ); |
| 443 | - return $plan_info->supports_search() && ! $plan_info->is_disabled_due_to_overage(); | |
| 444 | + return $plan_info->supports_search() | |
| 445 | + && method_exists( $plan_info, 'is_free_search_plan' ) | |
| 446 | + && ! $plan_info->is_free_search_plan() | |
| 447 | + && ! $plan_info->is_disabled_due_to_overage(); | |
| 444 | 448 | } |
| 445 | 449 | } |
| 446 | 450 | |
| 447 | 451 | if ( ! class_exists( Plan::class ) ) { |
| @@ -452,9 +456,11 @@ | ||
| 452 | 456 | if ( ! is_array( $plan_info ) ) { |
| 453 | 457 | return false; |
| 454 | 458 | } |
| 455 | 459 | |
| 456 | - return ! empty( $plan_info['supports_search'] ) | |
| 460 | + return ! Search_Helper::is_forced_free_plan() | |
| 461 | + && ! empty( $plan_info['supports_search'] ) | |
| 462 | + && ( $plan_info['effective_subscription']['product_slug'] ?? null ) !== Plan::JETPACK_SEARCH_FREE_PRODUCT_SLUG | |
| 457 | 463 | && empty( $plan_info['plan_usage']['must_upgrade'] ); |
| 458 | 464 | } |
| 459 | 465 | |
| 460 | 466 | /** |