mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 01:20:07 +00:00
Remove language switching alert box temporary feature flag
Remove everything related to the `wgVectorLanguageInHeader` feature flag and rely on the LangaugeInHeader feature instead. Bug: T297237 Change-Id: Ida2c588e03f759d2eefc7c67ff44dcdd9a100f9a
This commit is contained in:
parent
4813aba27a
commit
29b982999f
|
@ -148,21 +148,6 @@ final class Constants {
|
||||||
*/
|
*/
|
||||||
public const FEATURE_LANGUAGE_IN_MAIN_PAGE_HEADER = 'LanguageInMainPageHeader';
|
public const FEATURE_LANGUAGE_IN_MAIN_PAGE_HEADER = 'LanguageInMainPageHeader';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public const REQUIREMENT_LANGUAGE_ALERT_IN_SIDEBAR = 'LanguageAlertInSidebar';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public const CONFIG_LANGUAGE_ALERT_IN_SIDEBAR = 'VectorLanguageAlertInSidebar';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public const FEATURE_LANGUAGE_ALERT_IN_SIDEBAR = 'LanguageAlertInSidebar';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -134,27 +134,6 @@ return [
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Feature: T295555: Language switch alert in sidebar
|
|
||||||
// ================================
|
|
||||||
$featureManager->registerRequirement(
|
|
||||||
new OverridableConfigRequirement(
|
|
||||||
$services->getMainConfig(),
|
|
||||||
$context->getUser(),
|
|
||||||
$context->getRequest(),
|
|
||||||
Constants::CONFIG_LANGUAGE_ALERT_IN_SIDEBAR,
|
|
||||||
Constants::REQUIREMENT_LANGUAGE_ALERT_IN_SIDEBAR
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$featureManager->registerFeature(
|
|
||||||
Constants::FEATURE_LANGUAGE_ALERT_IN_SIDEBAR,
|
|
||||||
[
|
|
||||||
Constants::REQUIREMENT_FULLY_INITIALISED,
|
|
||||||
Constants::REQUIREMENT_LANGUAGE_IN_HEADER,
|
|
||||||
Constants::REQUIREMENT_LANGUAGE_ALERT_IN_SIDEBAR
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Feature: Sticky header
|
// Feature: Sticky header
|
||||||
// ================================
|
// ================================
|
||||||
$featureManager->registerRequirement(
|
$featureManager->registerRequirement(
|
||||||
|
|
|
@ -208,7 +208,7 @@ class SkinVector22 extends SkinMustache {
|
||||||
$shouldShowOnMainPage = $isMainPage && !empty( $this->getLanguagesCached() ) &&
|
$shouldShowOnMainPage = $isMainPage && !empty( $this->getLanguagesCached() ) &&
|
||||||
$featureManager->isFeatureEnabled( Constants::FEATURE_LANGUAGE_IN_MAIN_PAGE_HEADER );
|
$featureManager->isFeatureEnabled( Constants::FEATURE_LANGUAGE_IN_MAIN_PAGE_HEADER );
|
||||||
return ( $this->isLanguagesInContentAt( 'top' ) && !$isMainPage && !$this->shouldHideLanguages() &&
|
return ( $this->isLanguagesInContentAt( 'top' ) && !$isMainPage && !$this->shouldHideLanguages() &&
|
||||||
$featureManager->isFeatureEnabled( Constants::FEATURE_LANGUAGE_ALERT_IN_SIDEBAR ) ) ||
|
$featureManager->isFeatureEnabled( Constants::FEATURE_LANGUAGE_IN_HEADER ) ) ||
|
||||||
$shouldShowOnMainPage;
|
$shouldShowOnMainPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -566,13 +566,6 @@
|
||||||
},
|
},
|
||||||
"description": "@var When `VectorLanguageInHeader` is enabled, determines whether the Main Page's language button should be at the top or bottom of the content. The default position on the main page is at the bottom."
|
"description": "@var When `VectorLanguageInHeader` is enabled, determines whether the Main Page's language button should be at the top or bottom of the content. The default position on the main page is at the bottom."
|
||||||
},
|
},
|
||||||
"VectorLanguageAlertInSidebar": {
|
|
||||||
"value": {
|
|
||||||
"logged_in": true,
|
|
||||||
"logged_out": true
|
|
||||||
},
|
|
||||||
"description": "@var When `VectorLanguageAlertInSidebar` is enabled, the language switch alert box is shown in the sidebar."
|
|
||||||
},
|
|
||||||
"VectorStickyHeader": {
|
"VectorStickyHeader": {
|
||||||
"value": {
|
"value": {
|
||||||
"logged_in": true,
|
"logged_in": true,
|
||||||
|
|
|
@ -138,7 +138,7 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
||||||
* Standard config for Language Alert in Sidebar
|
* Standard config for Language Alert in Sidebar
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function enableLanguageAlertFeatureConfig(): array {
|
private function enableLanguageInHeaderFeatureConfig(): array {
|
||||||
return [
|
return [
|
||||||
'VectorLanguageInHeader' => [
|
'VectorLanguageInHeader' => [
|
||||||
'logged_in' => true,
|
'logged_in' => true,
|
||||||
|
@ -148,10 +148,6 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
||||||
'logged_in' => false,
|
'logged_in' => false,
|
||||||
'logged_out' => false
|
'logged_out' => false
|
||||||
],
|
],
|
||||||
'VectorLanguageAlertInSidebar' => [
|
|
||||||
'logged_in' => true,
|
|
||||||
'logged_out' => true
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,45 +170,27 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
'When the feature is enabled and languages should be hidden, do not show alert' => [
|
'When the feature is enabled and languages should be hidden, do not show alert' => [
|
||||||
$this->enableLanguageAlertFeatureConfig(),
|
$this->enableLanguageInHeaderFeatureConfig(),
|
||||||
$testTitle,
|
$testTitle,
|
||||||
[], true, true, false
|
[], true, true, false
|
||||||
],
|
],
|
||||||
'When the language alert feature is disabled, do not show alert' => [
|
|
||||||
[
|
|
||||||
'VectorLanguageInHeader' => [
|
|
||||||
'logged_in' => true,
|
|
||||||
'logged_out' => true
|
|
||||||
],
|
|
||||||
'VectorLanguageAlertInSidebar' => [
|
|
||||||
'logged_in' => false,
|
|
||||||
'logged_out' => false
|
|
||||||
]
|
|
||||||
],
|
|
||||||
$testTitle,
|
|
||||||
[ 'fr', 'en', 'ko' ], true, false, false
|
|
||||||
],
|
|
||||||
'When the language in header feature is disabled, do not show alert' => [
|
'When the language in header feature is disabled, do not show alert' => [
|
||||||
[
|
[
|
||||||
'VectorLanguageInHeader' => [
|
'VectorLanguageInHeader' => [
|
||||||
'logged_in' => false,
|
'logged_in' => false,
|
||||||
'logged_out' => false
|
'logged_out' => false
|
||||||
],
|
],
|
||||||
'VectorLanguageAlertInSidebar' => [
|
|
||||||
'logged_in' => true,
|
|
||||||
'logged_out' => true
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
$testTitle,
|
$testTitle,
|
||||||
[ 'fr', 'en', 'ko' ], true, false, false
|
[ 'fr', 'en', 'ko' ], true, false, false
|
||||||
],
|
],
|
||||||
'When it is a main page, feature is enabled, and there are no languages, do not show alert' => [
|
'When it is a main page, feature is enabled, and there are no languages, do not show alert' => [
|
||||||
$this->enableLanguageAlertFeatureConfig(),
|
$this->enableLanguageInHeaderFeatureConfig(),
|
||||||
$testTitleMainPage,
|
$testTitleMainPage,
|
||||||
[], true, true, false
|
[], true, true, false
|
||||||
],
|
],
|
||||||
'When it is a non-main page, feature is enabled, and there are no languages, do not show alert' => [
|
'When it is a non-main page, feature is enabled, and there are no languages, do not show alert' => [
|
||||||
$this->enableLanguageAlertFeatureConfig(),
|
$this->enableLanguageInHeaderFeatureConfig(),
|
||||||
$testTitle,
|
$testTitle,
|
||||||
[], true, true, false
|
[], true, true, false
|
||||||
],
|
],
|
||||||
|
@ -222,45 +200,27 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
||||||
'logged_in' => false,
|
'logged_in' => false,
|
||||||
'logged_out' => false
|
'logged_out' => false
|
||||||
],
|
],
|
||||||
'VectorLanguageAlertInSidebar' => [
|
|
||||||
'logged_in' => true,
|
|
||||||
'logged_out' => true
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
$testTitleMainPage,
|
$testTitleMainPage,
|
||||||
[ 'fr', 'en', 'ko' ], true, true, false
|
[ 'fr', 'en', 'ko' ], true, true, false
|
||||||
],
|
],
|
||||||
'When it is a non-main page, alert feature is disabled, there are languages, do not show alert' => [
|
|
||||||
[
|
|
||||||
'VectorLanguageInHeader' => [
|
|
||||||
'logged_in' => true,
|
|
||||||
'logged_out' => true
|
|
||||||
],
|
|
||||||
'VectorLanguageAlertInSidebar' => [
|
|
||||||
'logged_in' => false,
|
|
||||||
'logged_out' => false
|
|
||||||
]
|
|
||||||
],
|
|
||||||
$testTitle,
|
|
||||||
[ 'fr', 'en', 'ko' ], true, true, false
|
|
||||||
],
|
|
||||||
'When most requirements are present but languages are not at the top, do not show alert' => [
|
'When most requirements are present but languages are not at the top, do not show alert' => [
|
||||||
$this->enableLanguageAlertFeatureConfig(),
|
$this->enableLanguageInHeaderFeatureConfig(),
|
||||||
$testTitle,
|
$testTitle,
|
||||||
[ 'fr', 'en', 'ko' ], false, false, false
|
[ 'fr', 'en', 'ko' ], false, false, false
|
||||||
],
|
],
|
||||||
'When most requirements are present but languages should be hidden, do not show alert' => [
|
'When most requirements are present but languages should be hidden, do not show alert' => [
|
||||||
$this->enableLanguageAlertFeatureConfig(),
|
$this->enableLanguageInHeaderFeatureConfig(),
|
||||||
$testTitle,
|
$testTitle,
|
||||||
[ 'fr', 'en', 'ko' ], true, true, false
|
[ 'fr', 'en', 'ko' ], true, true, false
|
||||||
],
|
],
|
||||||
'When it is a main page, features are enabled, and there are languages, show alert' => [
|
'When it is a main page, features are enabled, and there are languages, show alert' => [
|
||||||
$this->enableLanguageAlertFeatureConfig(),
|
$this->enableLanguageInHeaderFeatureConfig(),
|
||||||
$testTitleMainPage,
|
$testTitleMainPage,
|
||||||
[ 'fr', 'en', 'ko' ], true, false, true
|
[ 'fr', 'en', 'ko' ], true, false, true
|
||||||
],
|
],
|
||||||
'When all the requirements are present on a non-main page, show alert' => [
|
'When all the requirements are present on a non-main page, show alert' => [
|
||||||
$this->enableLanguageAlertFeatureConfig(),
|
$this->enableLanguageInHeaderFeatureConfig(),
|
||||||
$testTitle,
|
$testTitle,
|
||||||
[ 'fr', 'en', 'ko' ], true, false, true
|
[ 'fr', 'en', 'ko' ], true, false, true
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue