Compact links beta feature conditions sync

Enforce same conditions on enabling as on showing the BetaFeatures preference
to the user, for the sake of clarity.

Bug: 62362
Change-Id: I11ee32a90ba8ecca9136a6ff33581bf6d72240bd
This commit is contained in:
Nemo bis
2014-05-11 17:48:21 +02:00
parent c2397f420b
commit 8d33793472

View File

@@ -45,7 +45,8 @@ class UniversalLanguageSelectorHooks {
* Hook: BeforePageDisplay * Hook: BeforePageDisplay
*/ */
public static function addModules( $out, $skin ) { public static function addModules( $out, $skin ) {
global $wgULSCompactLinks, $wgULSPosition, $wgULSGeoService, $wgULSEventLogging; global $wgULSCompactLinks, $wgULSPosition, $wgULSGeoService, $wgULSEventLogging,
$wgInterwikiMagic, $wgHideInterlanguageLinks;
// Load the style for users without JS, to hide the useless links // Load the style for users without JS, to hide the useless links
$out->addModuleStyles( 'ext.uls.nojs' ); $out->addModuleStyles( 'ext.uls.nojs' );
@@ -62,8 +63,11 @@ class UniversalLanguageSelectorHooks {
// If the extension is enabled, basic features (API, language data) available. // If the extension is enabled, basic features (API, language data) available.
$out->addModules( 'ext.uls.init' ); $out->addModules( 'ext.uls.init' );
// If compact ULS beta feature is enabled // If compact ULS beta feature is enabled and is actually functional
// (see onGetBetaFeaturePreferences)
if ( $wgULSCompactLinks && if ( $wgULSCompactLinks &&
$wgInterwikiMagic === true &&
$wgHideInterlanguageLinks === false &&
class_exists( 'BetaFeatures' ) && class_exists( 'BetaFeatures' ) &&
BetaFeatures::isFeatureEnabled( $out->getUser(), 'uls-compact-links' ) BetaFeatures::isFeatureEnabled( $out->getUser(), 'uls-compact-links' )
) { ) {