diff --git a/includes/Constants.php b/includes/Constants.php index 008f3d78..9e17e1c1 100644 --- a/includes/Constants.php +++ b/includes/Constants.php @@ -168,21 +168,6 @@ final class Constants { */ public const QUERY_PARAM_SKIN = 'useskin'; - /** - * @var string - */ - public const FEATURE_USE_WVUI_SEARCH = 'UseWvuiSearch'; - - /** - * @var string - */ - public const CONFIG_KEY_USE_WVUI_SEARCH = 'VectorUseWvuiSearch'; - - /** - * @var string - */ - public const REQUIREMENT_USE_WVUI_SEARCH = 'VectorUseWvuiSearch'; - /** * @var string */ @@ -256,18 +241,6 @@ final class Constants { */ public const SEARCH_BOX_INPUT_LOCATION_DEFAULT = 'header-navigation'; - /** - * Defines whether or not the Core/Vue.js Search Widget A/B test is running. See - * https://phabricator.wikimedia.org/T261647 for additional detail about the test. - * - * Note well that if the associated config value is falsy, then we fall back to choosing the - * search widget treatment based on the `VectorUseWvuiSearch` config variable (see - * `resources/skins.vector.js/searchLoader.js`). - * - * @var string - */ - public const CONFIG_SEARCH_TREATMENT_AB_TEST = 'VectorSearchTreatmentABTest'; - /** * @var string */ diff --git a/includes/FeatureManagement/Requirements/WvuiSearchTreatmentRequirement.php b/includes/FeatureManagement/Requirements/WvuiSearchTreatmentRequirement.php deleted file mode 100644 index d3cbf45e..00000000 --- a/includes/FeatureManagement/Requirements/WvuiSearchTreatmentRequirement.php +++ /dev/null @@ -1,84 +0,0 @@ -config = $config; - $this->user = $user; - } - - /** - * @inheritDoc - */ - public function getName(): string { - return Constants::REQUIREMENT_USE_WVUI_SEARCH; - } - - /** - * If A/B test is enabled check whether the user is logged in and bucketed. - * Fallback to `VectorUseWvuiSearch` config value. - * - * @inheritDoc - * @throws \ConfigException - */ - public function isMet(): bool { - // Determine the search widget treatment to send to the user - $shouldUseWvuiSearch = (bool)$this->config->get( Constants::CONFIG_KEY_USE_WVUI_SEARCH ); - - if ( (bool)$this->config->get( Constants::CONFIG_SEARCH_TREATMENT_AB_TEST ) && $this->user->isRegistered() ) { - $shouldUseWvuiSearch = $this->user->getID() % 2 === 0; - } - - return $shouldUseWvuiSearch; - } -} diff --git a/includes/Hooks.php b/includes/Hooks.php index 58ff6288..b097f2b6 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -608,12 +608,7 @@ class Hooks { } else { // The modern Vector skin must also carry skin-vector for compatibility with older // skins. - $bodyAttrs['class'] .= ' skin-vector'; - } - - // Determine the search widget treatment to send to the user - if ( VectorServices::getFeatureManager()->isFeatureEnabled( Constants::FEATURE_USE_WVUI_SEARCH ) ) { - $bodyAttrs['class'] .= ' skin-vector-search-vue'; + $bodyAttrs['class'] .= ' skin-vector skin-vector-search-vue'; } $config = $sk->getConfig(); diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 9cb9bf62..911e48ba 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -28,7 +28,6 @@ use Vector\FeatureManagement\FeatureManager; use Vector\FeatureManagement\Requirements\DynamicConfigRequirement; use Vector\FeatureManagement\Requirements\LatestSkinVersionRequirement; use Vector\FeatureManagement\Requirements\OverridableConfigRequirement; -use Vector\FeatureManagement\Requirements\WvuiSearchTreatmentRequirement; use Vector\SkinVersionLookup; return [ @@ -202,24 +201,6 @@ return [ ] ); - // Feature: Use Wvui Search - // ================================ - $featureManager->registerRequirement( - new WvuiSearchTreatmentRequirement( - $services->getMainConfig(), - $context->getUser() - ) - ); - - $featureManager->registerFeature( - Constants::FEATURE_USE_WVUI_SEARCH, - [ - Constants::REQUIREMENT_FULLY_INITIALISED, - Constants::REQUIREMENT_LATEST_SKIN_VERSION, - Constants::REQUIREMENT_USE_WVUI_SEARCH - ] - ); - // Feature: Sticky header // ================================ $featureManager->registerRequirement( diff --git a/includes/SkinVector.php b/includes/SkinVector.php index 85e5b3fd..092d942d 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -713,12 +713,7 @@ class SkinVector extends SkinMustache { string $formId, bool $autoExpandWidth ) { - $searchClass = ''; - - // Determine the search widget treatment to send to the user - if ( VectorServices::getFeatureManager()->isFeatureEnabled( Constants::FEATURE_USE_WVUI_SEARCH ) ) { - $searchClass .= 'vector-search-box-vue '; - } + $searchClass = 'vector-search-box-vue '; if ( $isCollapsible ) { $searchClass .= ' vector-search-box-collapses '; @@ -790,8 +785,7 @@ class SkinVector extends SkinMustache { private function doesSearchHaveThumbnails(): bool { $featureManager = VectorServices::getFeatureManager(); - return $featureManager->isFeatureEnabled( Constants::FEATURE_USE_WVUI_SEARCH ) && - $this->getConfig()->get( 'VectorWvuiSearchOptions' )['showThumbnail']; + return $this->getConfig()->get( 'VectorWvuiSearchOptions' )['showThumbnail']; } /** diff --git a/resources/skins.vector.js/searchLoader.js b/resources/skins.vector.js/searchLoader.js index c43e1eda..5525b59c 100644 --- a/resources/skins.vector.js/searchLoader.js +++ b/resources/skins.vector.js/searchLoader.js @@ -140,7 +140,7 @@ function markLoadEnd( startMarker, endMarker, measureMarker ) { */ function initSearchLoader( document ) { var searchBoxes = document.querySelectorAll( '.vector-search-box' ), - shouldUseCoreSearch; + isWikidata = mw.config.get( 'wgWikiID' ) === 'wikidatawiki'; // Allow developers to defined $wgVectorSearchHost in LocalSettings to target different APIs if ( config.wgVectorSearchHost ) { @@ -151,28 +151,16 @@ function initSearchLoader( document ) { return; } - shouldUseCoreSearch = !document.body.classList.contains( 'skin-vector-search-vue' ); - /** - * 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 + * 1. If we are in a browser that doesn't support fetch fall back to non-JS version. + * 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. + * 2. Disable on Wikidata per T281318 until the REST API is ready. **/ - if ( shouldUseCoreSearch || !window.fetch ) { - Array.prototype.forEach.call( searchBoxes, function ( searchBox ) { - var input = searchBox.querySelector( 'input[name="search"]' ); - if ( input ) { - loadSearchModule( - input, - 'mediawiki.searchSuggest', - null, - null - ); - } - } ); + if ( isWikidata || !window.fetch ) { + document.body.classList.remove( + 'skin-vector-search-vue' + ); return; } diff --git a/skin.json b/skin.json index 3176dedd..3f0b2db6 100644 --- a/skin.json +++ b/skin.json @@ -403,17 +403,10 @@ "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." }, - "VectorUseWvuiSearch": { - "value": true - }, "VectorSkinMigrationMode": { "value": false, "description": "@internal. For usage to fulfil [[phab:T291098]]" }, - "VectorSearchTreatmentABTest": { - "value": false, - "description": "@var boolean Enables or disables the search treatment A/B test. See https://phabricator.wikimedia.org/T261647 and associated tasks for additional detail." - }, "VectorWvuiSearchOptions": { "value": { "showThumbnail": true, diff --git a/tests/phpunit/unit/FeatureManagement/Requirements/WvuiSearchTreatmentRequirementTest.php b/tests/phpunit/unit/FeatureManagement/Requirements/WvuiSearchTreatmentRequirementTest.php deleted file mode 100644 index 0182414c..00000000 --- a/tests/phpunit/unit/FeatureManagement/Requirements/WvuiSearchTreatmentRequirementTest.php +++ /dev/null @@ -1,133 +0,0 @@ - $wvuiSearchConfigValue, - Constants::CONFIG_SEARCH_TREATMENT_AB_TEST => $abValue, - ] ); - - $user = $this->createMock( User::class ); - $user->method( 'isRegistered' )->willReturn( $userId !== 0 ); - $user->method( 'getID' )->willReturn( $userId ); - - $requirement = new WvuiSearchTreatmentRequirement( - $config, $user - ); - - $this->assertSame( $expected, $requirement->isMet(), $msg ); - } -}