Jhernandez has uploaded a new change for review.

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

Change subject: Hygiene: #processLinks Only use global variables at the edges
......................................................................

Hygiene: #processLinks Only use global variables at the edges

Instead of defaulting the config to the global mw.config when the param
is not defined, always pass it in (it is called just once in application
code), that way there's no need to test for the optional argument
behavior and the function is pure.

Change-Id: Ib1addb3060826f58dce2d6f928252ce1888a4293
---
M resources/ext.popups/boot.js
M resources/ext.popups/processLinks.js
2 files changed, 3 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/31/324431/1

diff --git a/resources/ext.popups/boot.js b/resources/ext.popups/boot.js
index 9ae31b3..e9a2f81 100644
--- a/resources/ext.popups/boot.js
+++ b/resources/ext.popups/boot.js
@@ -107,7 +107,8 @@
                        var previewLinks =
                                mw.popups.processLinks(
                                        $container,
-                                       BLACKLISTED_LINKS
+                                       BLACKLISTED_LINKS,
+                                       mw.config
                                );
 
                        mw.popups.renderer.init();
diff --git a/resources/ext.popups/processLinks.js 
b/resources/ext.popups/processLinks.js
index 0f46464..66443e3 100644
--- a/resources/ext.popups/processLinks.js
+++ b/resources/ext.popups/processLinks.js
@@ -58,16 +58,12 @@
         * @param {jQuery} $container
         * @param {String[]} blacklist If an `<a>` has one or more of these CSS
         *  classes, then it will be ignored.
-        * @param {mw.Map} [config] defaults to the value of mediaWiki.config
+        * @param {mw.Map} config
         *
         * @return {jQuery}
         */
        mw.popups.processLinks = function ( $container, blacklist, config ) {
                var contentNamespaces;
-
-               if ( typeof config === 'undefined' ) {
-                       config = mw.config;
-               }
 
                contentNamespaces = config.get( 'wgContentNamespaces' );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/324431
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1addb3060826f58dce2d6f928252ce1888a4293
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: mpga
Gerrit-Owner: Jhernandez <jhernan...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to