Jforrester has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392882 )

Change subject: RCFilters: Respect subpage in RCLinked
......................................................................

RCFilters: Respect subpage in RCLinked

Make sure that when we redirect a URL when there's a saved query,
we retain the information about a subpage.

Then, normalize the URL to always use &target=xxx so that the
system knows to correct the value if the user uses the form that
is, for the moment, outside the regular RCFilters interface.

Bug: T181100
Change-Id: I75cfb2b56a4da6357e6117b3f34f3178bfb2c90c
(cherry picked from commit 28132fb14afe23b27942150a2fb8b265ece40451)
---
M includes/specials/SpecialRecentchangeslinked.php
M resources/src/mediawiki.rcfilters/mw.rcfilters.UriProcessor.js
2 files changed, 27 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/82/392882/1

diff --git a/includes/specials/SpecialRecentchangeslinked.php 
b/includes/specials/SpecialRecentchangeslinked.php
index 358a309..e4cc3d1 100644
--- a/includes/specials/SpecialRecentchangeslinked.php
+++ b/includes/specials/SpecialRecentchangeslinked.php
@@ -30,6 +30,8 @@
        /** @var bool|Title */
        protected $rclTargetTitle;
 
+       protected $rclTarget;
+
        function __construct() {
                parent::__construct( 'Recentchangeslinked' );
        }
@@ -44,6 +46,7 @@
 
        public function parseParameters( $par, FormOptions $opts ) {
                $opts['target'] = $par;
+               $this->rclTarget = $par;
        }
 
        /**
@@ -293,4 +296,15 @@
        public function prefixSearchSubpages( $search, $limit, $offset ) {
                return $this->prefixSearchString( $search, $limit, $offset );
        }
+
+       /**
+        * Get a self-referential title object
+        * with consideration to the given subpage.
+        *
+        * @return Title
+        * @since 1.23
+        */
+       public function getPageTitle() {
+               return parent::getPageTitle( $this->rclTarget );
+       }
 }
diff --git a/resources/src/mediawiki.rcfilters/mw.rcfilters.UriProcessor.js 
b/resources/src/mediawiki.rcfilters/mw.rcfilters.UriProcessor.js
index 621c200..fe806ed 100644
--- a/resources/src/mediawiki.rcfilters/mw.rcfilters.UriProcessor.js
+++ b/resources/src/mediawiki.rcfilters/mw.rcfilters.UriProcessor.js
@@ -63,13 +63,25 @@
         * @return {mw.Uri} Updated Uri
         */
        mw.rcfilters.UriProcessor.prototype.getUpdatedUri = function ( uriQuery 
) {
-               var uri = new mw.Uri(),
+               var titlePieces,
+                       uri = new mw.Uri(),
                        unrecognizedParams = this.getUnrecognizedParams( 
uriQuery || uri.query );
 
                if ( uriQuery ) {
                        // This is mainly for tests, to be able to give the 
method
                        // an initial URI Query and test that it retains 
parameters
                        uri.query = uriQuery;
+               }
+
+               // Normalize subpage to use &target= so we are always
+               // consistent in Special:RecentChangesLinked between the
+               // ?title=Special:RecentChangesLinked/TargetPage and
+               // ?title=Special:RecentChangesLinked&target=TargetPage
+               if ( uri.query.title && uri.query.title.indexOf( '/' ) !== -1 ) 
{
+                       titlePieces = uri.query.title.split( '/' );
+
+                       unrecognizedParams.title = titlePieces.shift();
+                       unrecognizedParams.target = titlePieces.join( '/' );
                }
 
                uri.query = this.filtersModel.getMinimizedParamRepresentation(
@@ -87,7 +99,6 @@
 
                // Reapply unrecognized params and url version
                uri.query = $.extend( true, {}, uri.query, unrecognizedParams, 
{ urlversion: '2' } );
-
                return uri;
        };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/392882
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I75cfb2b56a4da6357e6117b3f34f3178bfb2c90c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.31.0-wmf.8
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to