CompactLinks: support sortPrepend from WikiBaseClient
Bug: T138973 Change-Id: I64b7aa37d8a6b3cac92d492a33fe6f8cb04ce0e6
This commit is contained in:
committed by
Nikerabbit
parent
0240e0aed6
commit
4f4051a40d
@@ -311,7 +311,8 @@ class UniversalLanguageSelectorHooks {
|
|||||||
$wgULSEventLogging,
|
$wgULSEventLogging,
|
||||||
$wgULSImeSelectors, $wgULSNoImeSelectors,
|
$wgULSImeSelectors, $wgULSNoImeSelectors,
|
||||||
$wgULSFontRepositoryBasePath,
|
$wgULSFontRepositoryBasePath,
|
||||||
$wgExtensionAssetsPath;
|
$wgExtensionAssetsPath,
|
||||||
|
$wgWBClientSettings;
|
||||||
|
|
||||||
// Place constant stuff here (not depending on request context)
|
// Place constant stuff here (not depending on request context)
|
||||||
if ( is_string( $wgULSGeoService ) ) {
|
if ( is_string( $wgULSGeoService ) ) {
|
||||||
@@ -334,6 +335,12 @@ class UniversalLanguageSelectorHooks {
|
|||||||
'/UniversalLanguageSelector/data/fontrepo/fonts/';
|
'/UniversalLanguageSelector/data/fontrepo/fonts/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cannot check where whether CLL is enabled for a particular user. The overhead
|
||||||
|
// of including this data is small.
|
||||||
|
if ( isset( $wgWBClientSettings['sortPrepend'] ) ) {
|
||||||
|
$vars['wgULSCompactLinksPrepend'] = $wgWBClientSettings['sortPrepend'];
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,6 +226,8 @@
|
|||||||
// Previous languages are always the better suggestion
|
// Previous languages are always the better suggestion
|
||||||
// because the user has explicitly chosen them.
|
// because the user has explicitly chosen them.
|
||||||
filterByPreviousLanguages,
|
filterByPreviousLanguages,
|
||||||
|
// Site specific highlights, mostly used on Wikimedia sites
|
||||||
|
filterBySitePicks,
|
||||||
// Add all common languages to the beginning of array.
|
// Add all common languages to the beginning of array.
|
||||||
// These are the most probable languages predicted by ULS.
|
// These are the most probable languages predicted by ULS.
|
||||||
this.getCommonLanguages,
|
this.getCommonLanguages,
|
||||||
@@ -277,6 +279,19 @@
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the language list by site picks.
|
||||||
|
*
|
||||||
|
* @return {Array} List of language codes supported by the article
|
||||||
|
*/
|
||||||
|
function filterBySitePicks( languages ) {
|
||||||
|
var picks = mw.config.get( 'wgULSCompactLinksPrepend' ) || [];
|
||||||
|
|
||||||
|
return $.grep( picks, function ( language ) {
|
||||||
|
return $.inArray( language, languages ) >= 0;
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the language list by common languages.
|
* Filter the language list by common languages.
|
||||||
* Common languages are the most probable languages predicted by ULS.
|
* Common languages are the most probable languages predicted by ULS.
|
||||||
|
|||||||
Reference in New Issue
Block a user