From 53f49c5c64fb8d25347ae07078cfd714c32c1faa Mon Sep 17 00:00:00 2001 From: Nicholas Ray Date: Fri, 22 Jan 2021 16:16:31 -0700 Subject: [PATCH] Rename `wgVectorUseCoreSearch` to `wgVectorUseWvuiSearch` This allows better compatibility with FeatureManager (e.g. can use requirements such as REQUIREMENT_LATEST_SKIN_VERSION). It will become especially useful in I70277c1082a504fbd5f6023e9873e8071de7e35d and when A/B testing search. Bug: T270202 Change-Id: I3a063e0b085765ea1db3c4478fb30c11b0942b75 --- includes/Hooks.php | 6 +++--- resources/VectorResourceLoaderVirtualConfig.d.ts | 2 +- resources/skins.vector.js/searchLoader.js | 6 +++--- resources/skins.vector.styles/VueEnhancedSearchBox.less | 2 +- skin.json | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/Hooks.php b/includes/Hooks.php index 0b4d59d..75796bd 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -37,7 +37,7 @@ class Hooks { ) { return [ 'wgVectorSearchHost' => $config->get( 'VectorSearchHost' ), - 'wgVectorUseCoreSearch' => $config->get( 'VectorUseCoreSearch' ), + 'wgVectorUseWvuiSearch' => $config->get( 'VectorUseWvuiSearch' ), ]; } @@ -103,7 +103,7 @@ class Hooks { } // Tell the `mediawiki.page.ready` module not to wire up search. - // This allows us to use $wgVectorUseCoreSearch to decide to load + // This allows us to use $wgVectorUseWvuiSearch to decide to load // the historic jquery autocomplete search or the new Vue implementation. // ResourceLoaderContext has no knowledge of legacy / modern Vector // and from its point of view they are the same thing. @@ -281,7 +281,7 @@ class Hooks { $config = $sk->getConfig(); - if ( !$config->get( 'VectorUseCoreSearch' ) ) { + if ( $config->get( 'VectorUseWvuiSearch' ) ) { $bodyAttrs['class'] .= ' skin-vector-search-vue'; } diff --git a/resources/VectorResourceLoaderVirtualConfig.d.ts b/resources/VectorResourceLoaderVirtualConfig.d.ts index a460c4d..51002c5 100644 --- a/resources/VectorResourceLoaderVirtualConfig.d.ts +++ b/resources/VectorResourceLoaderVirtualConfig.d.ts @@ -3,5 +3,5 @@ interface VectorResourceLoaderVirtualConfig { /** * The name of the ResourceLoader module that contains search. */ - wgVectorUseCoreSearch: boolean + wgVectorUseWvuiSearch: boolean } diff --git a/resources/skins.vector.js/searchLoader.js b/resources/skins.vector.js/searchLoader.js index eb52e49..972a6f7 100644 --- a/resources/skins.vector.js/searchLoader.js +++ b/resources/skins.vector.js/searchLoader.js @@ -14,7 +14,7 @@ var /** @type {VectorResourceLoaderVirtualConfig} */ // T251544: Collect search performance metrics to compare Vue search with // mediawiki.searchSuggest performance. SHOULD_TEST_SEARCH = !!( - !config.wgVectorUseCoreSearch && + config.wgVectorUseWvuiSearch && window.performance && performance.mark && performance.measure && @@ -142,14 +142,14 @@ function initSearchLoader( document ) { } /** - * 1. If $wgVectorUseCoreSearch is true, + * 1. If $wgVectorUseWvuiSearch is false, * or we are in a browser that doesn't support fetch * load the legacy searchSuggest module. The check for window.fetch * can be removed when IE11 support is finally officially dropped. * 2. If we're using a different search module, enable the loading indicator * before the search module loads. **/ - if ( config.wgVectorUseCoreSearch || !window.fetch ) { + if ( !config.wgVectorUseWvuiSearch || !window.fetch ) { loadSearchModule( searchInput, 'mediawiki.searchSuggest', function () {} ); } else { // Remove tooltips while Vue search is still loading diff --git a/resources/skins.vector.styles/VueEnhancedSearchBox.less b/resources/skins.vector.styles/VueEnhancedSearchBox.less index 10aa27d..eafe146 100644 --- a/resources/skins.vector.styles/VueEnhancedSearchBox.less +++ b/resources/skins.vector.styles/VueEnhancedSearchBox.less @@ -44,7 +44,7 @@ } // Only apply the following WVUI-related rules to clients who have js enabled. -// TODO: .skin-vector-search-vue class can be removed when $wgVectorUseCoreSearch is no longer supported. +// TODO: .skin-vector-search-vue class can be removed when $wgVectorUseWvuiSearch is no longer supported. .client-js .skin-vector-search-vue { // Derived from @size-search-figure in WVUI // https://gerrit.wikimedia.org/r/plugins/gitiles/wvui/+/e32b54f3b8d1118b6a25cdc46b5638d6d048533e/src/themes/wikimedia-ui.less#21 diff --git a/skin.json b/skin.json index b8ae3e1..d625f6e 100644 --- a/skin.json +++ b/skin.json @@ -219,8 +219,8 @@ "value": "1", "description": "@var string:['2'|'1'] The version ('2' for latest, '1' for legacy) of the Vector skin to **set** for newly created user accounts. **The value is persisted as a user preference.** This configuration is not used for preexisting accounts (see VectorDefaultSkinVersionForExistingAccounts) and only ever executed once at new account creation time." }, - "VectorUseCoreSearch": { - "value": true + "VectorUseWvuiSearch": { + "value": false }, "VectorWvuiSearchOptions": { "value": {