Show the "Move associated talk page button" on special:movepage if there are subpages...
authorBrian Wolff <bawolff@users.mediawiki.org>
Fri, 9 Sep 2011 00:40:27 +0000 (00:40 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Fri, 9 Sep 2011 00:40:27 +0000 (00:40 +0000)
that could be affected by it, even if the base page being moved does not have a talk page.

(I just had a discussion with mindrones on irc about how the current behaviour with the talkspace subpages sometimes being moved by "move subpages" button and sometimes not depending on if current page had a talk page (and thus had the move assoc. talk button auto checked) was really confusing to the average user.)

As an aside, Special:Movepage could probably do with some refactoring ;)

RELEASE-NOTES-1.19
includes/specials/SpecialMovepage.php

index 1d1c5a5..1b8c3db 100644 (file)
@@ -85,6 +85,8 @@ production.
 * (bug 23057) Importers no longer can 'edit' or 'create' a fully-protected page by
   importing a new revision into it
 * (bug 30192) Thumbnails of archived files are now deleted
+* Allowing moving the associated talk pages of subpages even if the base page
+  has no subpage.
 
 === API changes in 1.19 ===
 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
index 7a5a421..8fa44a0 100644 (file)
@@ -164,7 +164,17 @@ class MovePageForm extends UnlistedSpecialPage {
                }
 
                $oldTalk = $this->oldTitle->getTalkPage();
-               $considerTalk = ( !$this->oldTitle->isTalkPage() && $oldTalk->exists() );
+               $oldTitleSubpages = $this->oldTitle->hasSubpages();
+               $oldTitleTalkSubpages = $this->oldTitle->getTalkPage()->hasSubpages();
+
+               $canMoveSubpage = ( $oldTitleSubpages || $oldTitleTalkSubpages ) &&
+                       !count( $this->oldTitle->getUserPermissionsErrors( 'move-subpages', $user ) );
+
+               # We also want to be able to move assoc. subpage talk-pages even if base page
+               # has no associated talk page, so || with $oldTitleTalkSubpages.
+               $considerTalk = !$this->oldTitle->isTalkPage() && 
+                       ( $oldTalk->exists()
+                               || ( $oldTitleTalkSubpages && $canMoveSubpage ) );
 
                $dbr = wfGetDB( DB_SLAVE );
                if ( $wgFixDoubleRedirects ) {
@@ -278,9 +288,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        );
                }
 
-               if( ($this->oldTitle->hasSubpages() || $this->oldTitle->getTalkPage()->hasSubpages())
-                       && !count( $this->oldTitle->getUserPermissionsErrors( 'move-subpages', $user ) ) )
-               {
+               if( $canMoveSubpage ) {
                        $out->addHTML( "
                                <tr>
                                        <td></td>