RCFilters: Always replaceState the URL
authorMoriel Schottlender <moriel@gmail.com>
Wed, 14 Jun 2017 20:04:01 +0000 (13:04 -0700)
committerMoriel Schottlender <moriel@gmail.com>
Wed, 14 Jun 2017 20:09:19 +0000 (13:09 -0700)
Allow users to hit 'back' button to actually go back to their
previous page, rather than use 'back' button to undo their filter
toggling before they're allowed to go back to their previous
page.

Bug: T167919
Change-Id: I171799bd5c139addebcccc4799003f040c3f119b

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

index c5672ae..14f5a28 100644 (file)
                        this.uriProcessor.getVersion( currentUri.query ) !== 2 ||
                        this.uriProcessor.isNewState( currentUri.query, updatedUri.query )
                ) {
-                       if ( this.initializing ) {
-                               // Initially, when we just build the first page load
-                               // out of defaults, we want to replace the history
-                               mw.rcfilters.UriProcessor.static.replaceState( updatedUri );
-                       } else {
-                               mw.rcfilters.UriProcessor.static.pushState( updatedUri );
-                       }
+                       mw.rcfilters.UriProcessor.static.replaceState( updatedUri );
                }
        };
 
index 6e62436..da6bf8a 100644 (file)
                        // Set as ready
                        $( '.rcfilters-head' ).addClass( 'mw-rcfilters-ui-ready' );
 
-                       window.addEventListener( 'popstate', function () {
-                               // Update the state of the model from the URL
-                               // and re-fetch results into the changes list
-                               controller.updateStateFromUrl();
-                       } );
-
                        $( 'a.mw-helplink' ).attr(
                                'href',
                                'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:New_filters_for_edit_review'