Skip to content

Commit

Permalink
Search: Verify plan allows for instant search before checking the opt…
Browse files Browse the repository at this point in the history
…ion (#39384)

* Search: Verify plan allows for instant search before checking the option

* Remove calling deprecated function

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10946913845

Upstream-Ref: Automattic/jetpack@1e759e5
  • Loading branch information
kraftbj authored and matticbot committed Sep 19, 2024
1 parent a8804e3 commit 963485a
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 87 deletions.
1 change: 1 addition & 0 deletions jetpack_vendor/automattic/jetpack-search/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This is an alpha version! The changes listed here are not final.

### Changed
- Instant search: Use triggering element's document instead of the global `document`.
- Search: reduce database calls by ensuring plan support before checking options

### Fixed
- Use React properties rather than pass-throughs (e.g. `className` rather than `class`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use WP_Error;

/**
* To get and set Searh module settings
* To get and set Search module settings
*/
class Module_Control {
/**
Expand Down Expand Up @@ -73,7 +73,7 @@ public function is_active() {
* @return bool
*/
public function is_instant_search_enabled() {
return (bool) get_option( self::SEARCH_MODULE_INSTANT_SEARCH_OPTION_KEY );
return (bool) $this->plan->supports_instant_search() && get_option( self::SEARCH_MODULE_INSTANT_SEARCH_OPTION_KEY );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions jetpack_vendor/automattic/jetpack-search/src/class-plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ public function has_jetpack_search_product() {
*/
public function supports_instant_search() {
$plan_info = $this->get_plan_info();
return ( isset( $plan_info['supports_instant_search'] ) && $plan_info['supports_instant_search'] ) || $this->has_jetpack_search_product();
return ( isset( $plan_info['supports_instant_search'] ) && $plan_info['supports_instant_search'] );
}

/**
* Returns true if the plan support either Instant Search or Classic Search.
*/
public function supports_search() {
$plan_info = $this->get_plan_info();
return ( isset( $plan_info['supports_search'] ) && $plan_info['supports_search'] ) || $this->has_jetpack_search_product();
return ( isset( $plan_info['supports_search'] ) && $plan_info['supports_search'] );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
),
'jetpack-search-pkg' => array(
'path' => 'jetpack_vendor/automattic/jetpack-search',
'ver' => '0.45.5-alpha1726597270',
'ver' => '0.45.5-alpha1726771015',
),
'jetpack-stats' => array(
'path' => 'jetpack_vendor/automattic/jetpack-stats',
Expand Down
60 changes: 30 additions & 30 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-a8c-mc-stats",
"reference": "d11f3d345d5b3d38bbf97aaa37c62c4d81707226"
"reference": "05e47306c649714c18ea0bf0ba67a30d53c2fad9"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -60,7 +60,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
"reference": "b76e56a88ee38b2ef316c9c920ca607d920418c3"
"reference": "de0a6270579951de6672e92d4731bc9ea96ef2e8"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -125,7 +125,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
"reference": "c43d1b5eaf593dc676fd42c3399a8107edd26066"
"reference": "7e37a106320faf98f621ed22be55552f36a617a6"
},
"require": {
"automattic/jetpack-constants": "^2.0.4",
Expand Down Expand Up @@ -194,7 +194,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-autoloader",
"reference": "e66e41c755b0d0d1adfb9b0def53260ecf325b9d"
"reference": "91f14e6a485636940b40079566e6c0bf02ccf490"
},
"require": {
"composer-plugin-api": "^1.1 || ^2.0",
Expand Down Expand Up @@ -261,7 +261,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-core",
"reference": "7bb58d2cf43db4f2f5940193717f5ecf9429a5f7"
"reference": "3809c916ff182a6cf546878fddd6de74cf466134"
},
"require": {
"automattic/jetpack-connection": "^4.0.4",
Expand Down Expand Up @@ -329,7 +329,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-speed-score",
"reference": "6eb870282db793e1ea8fda0e706e71340cd4dc4b"
"reference": "a55cafbd1be92a6c8cce06efb3d8d30bf14c2934"
},
"require": {
"automattic/jetpack-boost-core": "^0.2.11",
Expand Down Expand Up @@ -405,7 +405,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
"reference": "538f902b1a3a84654d06829e454b5f18a4c2564a"
"reference": "78a8f16fd421bb625243fa352d1463d953a60bae"
},
"require": {
"composer-plugin-api": "^2.1.0",
Expand Down Expand Up @@ -465,7 +465,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
"reference": "0a705f3d1a6c859f2bb212e8422275a165814294"
"reference": "134035763b933c4f871fe59fa0b2ee4c2d12030b"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -540,7 +540,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
"reference": "2c5e55c57b9649de354feb57cdb3320c83b602c1"
"reference": "901b4a9193e5060784d14c5ba627c11bb7e4e4ea"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
Expand Down Expand Up @@ -630,7 +630,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "764fe16f9088c6419bf23ae9663593a628ffaf79"
"reference": "c28fe84baaf0a6b54ceced0f3a5464703a450946"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -684,7 +684,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
"reference": "d9fc929873d0a80769947ed0056eb368f434caef"
"reference": "649d3c6cc4d8f173ed7399221bf051f32da5f0ba"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -737,7 +737,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-explat",
"reference": "70ee825626b3a8d432351ce54dd5e7fa4b313633"
"reference": "cb18c413f11d87f6f84be2b7e3928120b3d32a0a"
},
"require": {
"automattic/jetpack-connection": "^4.0.4",
Expand Down Expand Up @@ -812,7 +812,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
"reference": "17212af006bd3eb7867fc0746bd746b1f2799579"
"reference": "8a180b608e0fbb336b19ac5330b0a27d1c33a421"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -870,7 +870,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-jitm",
"reference": "a16b631b3e07253a5b8123b7ac2c7e99cec81f80"
"reference": "5acc64c5561cbb0cc45c1f5288eed7cc53c6eac3"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
Expand Down Expand Up @@ -945,7 +945,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-licensing",
"reference": "a9d667b530fdc036812f8edd564751974f67fffb"
"reference": "cca9c46c4a932f501fc3bbbf4ae0d8e343212bd9"
},
"require": {
"automattic/jetpack-connection": "^4.0.4",
Expand Down Expand Up @@ -1007,7 +1007,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
"reference": "a61328a6b17553a7514ce4c7b35ae7041189b556"
"reference": "9476ecc026bc6a4e472b0b4f719f258a95a246d1"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1060,7 +1060,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-my-jetpack",
"reference": "34cc9f25b9c3c979a5ed92ed51dc1a5d7908e83b"
"reference": "d60fe1b68cd2a187b8ced4d614bf4f5b37315c97"
},
"require": {
"automattic/jetpack-admin-ui": "^0.4.5",
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
"reference": "ee627817a395ae039fa66077c7441f31d75a2279"
"reference": "e0922e070b527d0d3a0185801a68342c8db08441"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1223,7 +1223,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plans",
"reference": "13d58a1a5db49491950e0363e49b5bee81280d8d"
"reference": "ca2ee2ad43fedcdc420b6dde96e5cf3de0cee051"
},
"require": {
"automattic/jetpack-connection": "^4.0.4",
Expand Down Expand Up @@ -1291,7 +1291,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plugins-installer",
"reference": "35175811324b325ea48a5b87e6cc055069198d27"
"reference": "f49b43ef900bed1afb833b706e165f5f78a020e2"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
Expand Down Expand Up @@ -1347,7 +1347,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-models",
"reference": "b296b700799b8c08582c78ac3e0361446aad22e1"
"reference": "26851ffe95a0d10b56c33ae1121c442da9ec8ea7"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1417,7 +1417,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-status",
"reference": "cbaacd3b352f9502ab940b9c54073287141c39db"
"reference": "f2bdecc48341d056bf6a8ca5fed4a2a8f92ace85"
},
"require": {
"automattic/jetpack-connection": "^4.0.4",
Expand Down Expand Up @@ -1492,7 +1492,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
"reference": "7fc8fa03cfeb34fe27faacf20611b35829f8fb8c"
"reference": "9c59fb628fac56246f908da7bc57afd45e7c22fa"
},
"require": {
"automattic/jetpack-status": "^4.0.1",
Expand Down Expand Up @@ -1547,7 +1547,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
"reference": "ae92e639a0168e24f7a36776db2eb78f36319f11"
"reference": "2ef7705f0b8baeebbe4927a86686788374a3c652"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1596,12 +1596,12 @@
},
{
"name": "automattic/jetpack-search",
"version": "0.45.5-alpha.1726597270",
"version_normalized": "0.45.5.0-alpha1726597270",
"version": "0.45.5-alpha.1726771015",
"version_normalized": "0.45.5.0-alpha1726771015",
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-search",
"reference": "c3c3d2e639c323abb6c5edde65c0c96573814d96"
"reference": "9cf8a1d606521b9d7316cd02e2dd5d3ee05f2a3b"
},
"require": {
"automattic/jetpack-assets": "^2.3.8",
Expand Down Expand Up @@ -1689,7 +1689,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-stats",
"reference": "023b942259b3ad6426f13ad0f0afb47dfd1f15b4"
"reference": "be3b00e66f028ac26388d8501033e6f09d96511d"
},
"require": {
"automattic/jetpack-connection": "^4.0.4",
Expand Down Expand Up @@ -1756,7 +1756,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
"reference": "8dc18378c3bcd382b943ca9d2cb25b5a1bcfdf6a"
"reference": "83f7c599ead6d178b106542e1618dcc8768c2728"
},
"require": {
"automattic/jetpack-constants": "^2.0.4",
Expand Down Expand Up @@ -1820,7 +1820,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
"reference": "5a67bf4b901b4ad811ba10144e6bc6c83ccd0564"
"reference": "9b568de9401605615acd3d16eca0739985b02bf0"
},
"require": {
"automattic/jetpack-connection": "^4.0.4",
Expand Down
Loading

0 comments on commit 963485a

Please sign in to comment.