jenkins-bot has submitted this change and it was merged.
Change subject: CompactLinks: support sortPrepend from WikiBaseClient
......................................................................
CompactLinks: support sortPrepend from WikiBaseClient
Bug: T138973
Change-Id: I64b7aa37d8a6b3cac92d492a33fe6f8cb04ce0e6
---
M UniversalLanguageSelector.hooks.php
M resources/js/ext.uls.compactlinks.js
2 files changed, 23 insertions(+), 1 deletion(-)
Approvals:
Santhosh: Looks good to me, approved
Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/UniversalLanguageSelector.hooks.php
b/UniversalLanguageSelector.hooks.php
index 6326246..318ccca 100644
--- a/UniversalLanguageSelector.hooks.php
+++ b/UniversalLanguageSelector.hooks.php
@@ -311,7 +311,8 @@
$wgULSEventLogging,
$wgULSImeSelectors, $wgULSNoImeSelectors,
$wgULSFontRepositoryBasePath,
- $wgExtensionAssetsPath;
+ $wgExtensionAssetsPath,
+ $wgWBClientSettings;
// Place constant stuff here (not depending on request context)
if ( is_string( $wgULSGeoService ) ) {
@@ -334,6 +335,12 @@
'/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;
}
diff --git a/resources/js/ext.uls.compactlinks.js
b/resources/js/ext.uls.compactlinks.js
index 696cb86..d26167e 100644
--- a/resources/js/ext.uls.compactlinks.js
+++ b/resources/js/ext.uls.compactlinks.js
@@ -226,6 +226,8 @@
// Previous languages are always the better suggestion
// because the user has explicitly chosen them.
filterByPreviousLanguages,
+ // Site specific highlights, mostly used on Wikimedia
sites
+ filterBySitePicks,
// Add all common languages to the beginning of array.
// These are the most probable languages predicted by
ULS.
this.getCommonLanguages,
@@ -278,6 +280,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.
* Common languages are the most probable languages predicted by ULS.
*
--
To view, visit https://gerrit.wikimedia.org/r/301113
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I64b7aa37d8a6b3cac92d492a33fe6f8cb04ce0e6
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits