RCFilters: Retain extra url params when comparing url equivalency
authorMoriel Schottlender <moriel@gmail.com>
Mon, 12 Jun 2017 12:56:17 +0000 (05:56 -0700)
committerMoriel Schottlender <moriel@gmail.com>
Mon, 12 Jun 2017 13:01:00 +0000 (06:01 -0700)
The extra params should also dictate whether the URL should change,
so we update parameters that are external to RCFilters' model, like
limit and from, etc.

Bug: T167551
Change-Id: I21e35e7871abbc57634231b6330cc1fad8299860

resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js

index b7b46f6..375b68b 100644 (file)
                // actual parameter visibility/representation in the URL
                currentFilterState = this.filtersModel.getFiltersFromParameters( uri.query );
                updatedFilterState = this.filtersModel.getFiltersFromParameters( updatedUri.query );
+               // HACK: Re-merge extra parameters in
+               // This is a hack and a quickfix; a better, more sustainable
+               // fix is being worked on with a UriProcessor, but for now
+               // we need to make sure the **comparison** of whether currentFilterState
+               // and updatedFilterState differ **includes** the extra parameters in the URL
+               currentFilterState = $.extend( true, {}, uri.query, currentFilterState );
+               updatedFilterState = $.extend( true, {}, updatedUri.query, updatedFilterState );
 
                // Include highlight states
                $.extend( true,