Don't show language alert on main page if it has no languages

Bug: T299581
Change-Id: Idc5b702626249ebec5d627e7b88fd6adf3e3750a
This commit is contained in:
Clare Ming 2022-01-31 09:43:15 -07:00
parent 5daf29df0d
commit 5d2bc68da1

View file

@ -558,7 +558,7 @@ class SkinVector extends SkinMustache {
private function shouldLanguageAlertBeInSidebar(): bool { private function shouldLanguageAlertBeInSidebar(): bool {
$featureManager = VectorServices::getFeatureManager(); $featureManager = VectorServices::getFeatureManager();
$isMainPage = $this->getTitle() ? $this->getTitle()->isMainPage() : false; $isMainPage = $this->getTitle() ? $this->getTitle()->isMainPage() : false;
$shouldShowOnMainPage = $isMainPage && $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 && return ( $this->isLanguagesInContentAt( 'top' ) && !$isMainPage &&
$featureManager->isFeatureEnabled( Constants::FEATURE_LANGUAGE_ALERT_IN_SIDEBAR ) ) || $featureManager->isFeatureEnabled( Constants::FEATURE_LANGUAGE_ALERT_IN_SIDEBAR ) ) ||