Merge "RCLFilters: display target page as a title"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 13 Dec 2017 21:14:28 +0000 (21:14 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 13 Dec 2017 21:14:28 +0000 (21:14 +0000)
resources/src/mediawiki.rcfilters/mw.rcfilters.UriProcessor.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.RclTargetPageWidget.js
tests/qunit/suites/resources/mediawiki.rcfilters/UriProcessor.test.js

index 05aa2fc..7bb0a22 100644 (file)
                }
 
                // target in path
-               parts = uri.path.match( re );
+               parts = mw.Uri.decode( uri.path ).match( re );
                if ( parts ) {
                        uri.path = parts[ 1 ];
                        uri.query.target = parts[ 2 ];
index 6673c08..d5c5e26 100644 (file)
@@ -71,6 +71,7 @@
         * Respond to the model being updated
         */
        mw.rcfilters.ui.RclTargetPageWidget.prototype.updateUiBasedOnModel = function () {
-               this.titleSearch.setValue( this.model.getValue() );
+               var title = mw.Title.newFromText( this.model.getValue() );
+               this.titleSearch.setValue( title ? title.toText() : this.model.getValue() );
        };
 }( mediaWiki ) );
index a234d1a..fbd159c 100644 (file)
                                        output: 'http://host/wiki/Special:RecentChangesLinked?target=Moai',
                                        message: 'Target as subpage in path'
                                },
+                               {
+                                       input: 'http://host/wiki/Special:RecentChangesLinked/Château',
+                                       output: 'http://host/wiki/Special:RecentChangesLinked?target=Château',
+                                       message: 'Target as subpage in path with special characters'
+                               },
                                {
                                        input: 'http://host/wiki/Special:RecentChangesLinked/Moai/Sub1',
                                        output: 'http://host/wiki/Special:RecentChangesLinked?target=Moai/Sub1',