From: jenkins-bot Date: Mon, 15 May 2017 14:33:31 +0000 (+0000) Subject: Merge "RCFilters: Always put highlight values in the URL" X-Git-Tag: 1.31.0-rc.0~3252 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=1f86e53617274ea8b1e95d9fc989caa8230fde60;hp=4e74e8b1c60d123f65e7a111ff822b537466e503;p=lhc%2Fweb%2Fwiklou.git Merge "RCFilters: Always put highlight values in the URL" --- diff --git a/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js b/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js index 81b9dc36c9..4a9e780660 100644 --- a/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js +++ b/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js @@ -179,7 +179,8 @@ highlightedItems[ item.getName() ] = highlightEnabled ? item.getHighlightColor() : null; } ); - highlightedItems.highlight = this.filtersModel.isHighlightEnabled(); + // Stored as a string '0' or '1' + highlightedItems.highlight = String( Number( this.filtersModel.isHighlightEnabled() ) ); // Add item this.savedQueriesModel.addNewQuery( @@ -576,11 +577,15 @@ // highlight params uri.query.highlight = Number( this.filtersModel.isHighlightEnabled() ); Object.keys( highlightParams ).forEach( function ( paramName ) { - if ( highlightParams[ paramName ] ) { - uri.query[ paramName ] = highlightParams[ paramName ]; - } else { - delete uri.query[ paramName ]; - } + // Always have some value (either the color or null) so that + // if we have something in the URL that doesn't have the highlight + // intentionally, it can override default with highlight. + // Otherwise, the $.extend will always add the highlight that + // exists in the default even if the URL query that is being + // refreshed has different highlights, or has highlights enabled + // but no active highlights anywhere + uri.query[ paramName ] = highlightParams[ paramName ] ? + highlightParams[ paramName ] : null; } ); return uri;