Merge "RCFilters: Adjust server default variable names for limit/days"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 3 Aug 2017 00:07:36 +0000 (00:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 3 Aug 2017 00:07:36 +0000 (00:07 +0000)
languages/i18n/en.json
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FilterGroup.js
resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.less

index 497c87b..8f0ebb1 100644 (file)
        "recentchanges-legend-plusminus": "(<em>±123</em>)",
        "recentchanges-submit": "Show",
        "rcfilters-legend-heading": "<strong>List of abbreviations:</strong>",
-       "rcfilters-other-review-tools": "<strong>Other review tools:</strong>",
+       "rcfilters-other-review-tools": "<strong>Other review tools</strong>",
        "rcfilters-group-results-by-page": "Group results by page",
        "rcfilters-grouping-title": "Grouping",
        "rcfilters-activefilters": "Active filters",
index c4cce8d..f7021e2 100644 (file)
                        this.getType() === 'single_option' &&
                        !oneWasSelected
                ) {
+                       item = this.getItems()[ 0 ];
                        if ( defaultParams[ this.getName() ] ) {
                                item = this.getItemByParamName( defaultParams[ this.getName() ] );
-                       } else {
-                               item = this.getItems()[ 0 ];
                        }
+
                        result[ item.getName() ] = true;
                }
 
index 864e397..b489f4e 100644 (file)
@@ -92,7 +92,7 @@
                // Convert the default from the old preference
                // since the limit preference actually affects more
                // than just the RecentChanges page
-               limitDefault = Number( mw.user.options.get( 'rcfilters-rclimit', mw.user.options.get( 'rclimit', '50' ) ) );
+               limitDefault = Number( mw.user.options.get( 'rclimit', '50' ) );
 
                // Add parameter range operations
                views.range = {
                                        allowArbitrary: true,
                                        validate: $.isNumeric,
                                        range: {
-                                               min: 1,
+                                               min: 0, // The server normalizes negative numbers to 0 results
                                                max: 1000
                                        },
                                        sortFunc: function ( a, b ) { return Number( a.name ) - Number( b.name ); },
         * @param {string|string[]} arbitraryValues An array of arbitrary values to add to the group
         */
        mw.rcfilters.Controller.prototype.addNumberValuesToGroup = function ( groupData, arbitraryValues ) {
-               var controller = this;
+               var controller = this,
+                       normalizeWithinRange = function ( range, val ) {
+                               if ( val < range.min ) {
+                                       return range.min; // Min
+                               } else if ( val >= range.max ) {
+                                       return range.max; // Max
+                               }
+                               return val;
+                       };
 
                arbitraryValues = Array.isArray( arbitraryValues ) ? arbitraryValues : [ arbitraryValues ];
 
-               // Normalize the arbitrary values
+               // Normalize the arbitrary values and the default value for a range
                if ( groupData.range ) {
                        arbitraryValues = arbitraryValues.map( function ( val ) {
-                               if ( val < 0 ) {
-                                       return groupData.range.min; // Min
-                               } else if ( val >= groupData.range.max ) {
-                                       return groupData.range.max; // Max
-                               }
-                               return val;
+                               return normalizeWithinRange( groupData.range, val );
                        } );
+
+                       // Normalize the default, since that's user defined
+                       if ( groupData.default !== undefined ) {
+                               groupData.default = String( normalizeWithinRange( groupData.range, groupData.default ) );
+                       }
                }
 
                // This is only true for single_option group
index 7f0d34e..d48d52d 100644 (file)
@@ -7,6 +7,10 @@
        .mw-recentchanges-toplinks {
                padding: 0 0.5em;
 
+               .oo-ui-widget-enabled.oo-ui-buttonElement.oo-ui-buttonElement-frameless .oo-ui-buttonElement-button {
+                       padding: 0 2.5em 0 0.5em;
+               }
+
                &-title,
                .mw-collapsible-text {
                        // Same as the legend