Nikerabbit has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/301113

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(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/13/301113/1

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..67d2a4e 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: newchange
Gerrit-Change-Id: I64b7aa37d8a6b3cac92d492a33fe6f8cb04ce0e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to