jenkins-bot has submitted this change and it was merged.

Change subject: Display both subject and talk subpages for Special:MovePage
......................................................................


Display both subject and talk subpages for Special:MovePage

Editors were only able to see current page subpages, not subpages of
the corresponding talk page (if there is one). Consolidate display
routine in showSubpagesList. Conditionally show as needed

Adds 'movesubpagetalktext' to en.json for description of second
bulleted list.

Bug: T140026
Change-Id: Id5bb52411ab8249eda180b13aef7d8884064b5db
---
M includes/specials/SpecialMovepage.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 42 insertions(+), 15 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialMovepage.php 
b/includes/specials/SpecialMovepage.php
index 7b7661d..298d6c4 100644
--- a/includes/specials/SpecialMovepage.php
+++ b/includes/specials/SpecialMovepage.php
@@ -783,32 +783,57 @@
                LogEventsList::showLogExtract( $out, 'move', $title );
        }
 
+       /**
+        * Show subpages of the page being moved. Section is not shown if both 
current
+        * namespace does not support subpages and no talk subpages were found.
+        *
+        * @param Title $title Page being moved.
+        */
        function showSubpages( $title ) {
-               if ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
-                       return;
-               }
-
+               $nsHasSubpages = MWNamespace::hasSubpages( 
$title->getNamespace() );
                $subpages = $title->getSubpages();
                $count = $subpages instanceof TitleArray ? $subpages->count() : 
0;
 
-               $out = $this->getOutput();
-               $out->wrapWikiMsg( '== $1 ==', [ 'movesubpage', $count ] );
+               $titleIsTalk = $title->isTalkPage();
+               $subpagesTalk = $title->getTalkPage()->getSubpages();
+               $countTalk = $subpagesTalk instanceof TitleArray ? 
$subpagesTalk->count() : 0;
+               $totalCount = $count + $countTalk;
 
-               # No subpages.
-               if ( $count == 0 ) {
-                       $out->addWikiMsg( 'movenosubpage' );
-
+               if ( !$nsHasSubpages && $countTalk == 0 ) {
                        return;
                }
 
-               $out->addWikiMsg( 'movesubpagetext', 
$this->getLanguage()->formatNum( $count ) );
+               $this->getOutput()->wrapWikiMsg(
+                       '== $1 ==',
+                       [ 'movesubpage', ( $titleIsTalk ? $count : $totalCount 
) ]
+               );
+
+               if ( $nsHasSubpages ) {
+                       $this->showSubpagesList( $subpages, $count, 
'movesubpagetext', true );
+               }
+
+               if ( !$titleIsTalk && $countTalk > 0 ) {
+                       $this->showSubpagesList( $subpagesTalk, $countTalk, 
'movesubpagetalktext' );
+               }
+       }
+
+       function showSubpagesList( $subpages, $pagecount, $wikiMsg, 
$noSubpageMsg = false ) {
+               $out = $this->getOutput();
+
+               # No subpages.
+               if ( $pagecount == 0 && $noSubpageMsg ) {
+                       $out->addWikiMsg( 'movenosubpage' );
+                       return;
+               }
+
+               $out->addWikiMsg( $wikiMsg, $this->getLanguage()->formatNum( 
$pagecount ) );
                $out->addHTML( "<ul>\n" );
 
                $linkBatch = new LinkBatch( $subpages );
                $linkBatch->setCaller( __METHOD__ );
                $linkBatch->execute();
-
                $linkRenderer = $this->getLinkRenderer();
+
                foreach ( $subpages as $subpage ) {
                        $link = $linkRenderer->makeLink( $subpage );
                        $out->addHTML( "<li>$link</li>\n" );
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index d10749d..36f7461 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -2505,6 +2505,7 @@
        "movelogpagetext": "Below is a list of all page moves.",
        "movesubpage": "{{PLURAL:$1|Subpage|Subpages}}",
        "movesubpagetext": "This page has $1 {{PLURAL:$1|subpage|subpages}} 
shown below.",
+       "movesubpagetalktext": "The corresponding talk page has $1 
{{PLURAL:$1|subpage|subpages}} shown below.",
        "movenosubpage": "This page has no subpages.",
        "movereason": "Reason:",
        "move-redirect-text": "",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 96f8c38..a124d83 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -2687,9 +2687,10 @@
        "movepage-max-pages": "PROBABLY (A GUESS): when moving a page, you can 
select an option of moving its subpages, but there is a maximum that can be 
moved automatically.\n\nParameters:\n* $1 - maximum moved pages, defined in the 
variable 
[[mw:Special:MyLanguage/Manual:$wgMaximumMovedPages|$wgMaximumMovedPages]]",
        "movelogpage": "{{doc-logpage}}\n\nTitle of [[Special:Log/move]]. Used 
as heading on that page, and in the dropdown menu on log pages.",
        "movelogpagetext": "Text on the special page 'Move log'.",
-       "movesubpage": "This is a section header on [[Special:MovePage]], below 
is a list of subpages.\n\nParameters:\n* $1 - number of subpages\nSee also:\n* 
{{msg-mw|movenosubpage|without subpage}}\n* {{msg-mw|movesubpagetext|with 
subpages}}",
-       "movesubpagetext": "Used in [[Special:MovePage]]. Parameters:\n* $1 - 
number of subpages\nSee also:\n* {{msg-mw|movesubpage|section header}}\n* 
{{msg-mw|movenosubpage|without subpage}}",
-       "movenosubpage": "See also:\n* {{msg-mw|movesubpage|section header}}\n* 
{{msg-mw|movenosubpage|without subpage}}\n* {{msg-mw|movesubpagetext|with 
subpages}}",
+       "movesubpage": "This is a section header on [[Special:MovePage]], below 
is a list of subpages.\n\nParameters:\n* $1 - number of subpages\nSee also:\n* 
{{msg-mw|movenosubpage|without subpage}}\n* {{msg-mw|movesubpagetext|with 
subpages}}\n* {{msg-mw|movesubpagetalktext|with talk subpages}}",
+       "movesubpagetext": "Used in [[Special:MovePage]]. Parameters:\n* $1 - 
number of subpages\nSee also:\n* {{msg-mw|movesubpage|section header}}\n* 
{{msg-mw|movenosubpage|without subpage}}\n* {{msg-mw|movesubpagetalktext|with 
talk subpages}}",
+       "movesubpagetalktext": "Used in [[Special:MovePage]] when corresponding 
talk page has subpages. Parameters:\n* $1 - number of subpages\nSee also:\n* 
{{msg-mw|movesubpage|section header}}\n* {{msg-mw|movenosubpage|without 
subpage}}",
+       "movenosubpage": "See also:\n* {{msg-mw|movesubpage|section header}}\n* 
{{msg-mw|movenosubpage|without subpage}}\n* {{msg-mw|movesubpagetext|with 
subpages}}\n* {{msg-mw|movesubpagetalktext|with talk subpages}}",
        "movereason": "Used in [[Special:MovePage]]. The text for the inputbox 
to give a reason for the page move.\n\nSee also:\n* 
{{msg-mw|Move-page-legend|legend for the form}}\n* {{msg-mw|newtitle|label for 
new title}}\n* {{msg-mw|Movetalk|label for checkbox}}\n* 
{{msg-mw|Move-leave-redirect|label for checkbox}}\n* 
{{msg-mw|Fix-double-redirects|label for checkbox}}\n* 
{{msg-mw|Move-subpages|label for checkbox}}\n* 
{{msg-mw|Move-talk-subpages|label for checkbox}}\n* {{msg-mw|Move-watch|label 
for checkbox}}\n{{Identical|Reason}}",
        "move-redirect-text": "{{ignored}}The text that's added to a redirected 
page when that redirect is created.",
        "category-move-redirect-override": "{{ignored}}The text that's added to 
a redirected category page when that redirect is created.",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id5bb52411ab8249eda180b13aef7d8884064b5db
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Andy M. Wang <andym...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Andy M. Wang <andym...@gmail.com>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: TTO <at.li...@live.com.au>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to