RCFilters: Explicitly set the default highlight color to null
authorRoan Kattouw <roan.kattouw@gmail.com>
Tue, 10 Jul 2018 17:56:53 +0000 (10:56 -0700)
committerSbisson <sbisson@wikimedia.org>
Wed, 11 Jul 2018 17:30:44 +0000 (17:30 +0000)
Other code checks !== null on this, and since undefined !== null, it
will incorrectly think a highlight color is set when it's not.

Bug: T199144
Change-Id: I5dbe95ff3c2a5e9c4597a1794a0d3256b671238f

resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.ItemModel.js

index fef5226..63b0b03 100644 (file)
@@ -20,7 +20,7 @@
         * @cfg {string} [cssClass] The class identifying the results that match this filter
         * @cfg {string[]} [identifiers] An array of identifiers for this item. They will be
         *  added and considered in the view.
-        * @cfg {string} [defaultHighlightColor] If set, highlight this filter by default with this color
+        * @cfg {string} [defaultHighlightColor=null] If set, highlight this filter by default with this color
         */
        mw.rcfilters.dm.ItemModel = function MwRcfiltersDmItemModel( param, config ) {
                config = config || {};
@@ -41,7 +41,7 @@
 
                // Highlight
                this.cssClass = config.cssClass;
-               this.highlightColor = config.defaultHighlightColor;
+               this.highlightColor = config.defaultHighlightColor || null;
        };
 
        /* Initialization */