immobile-source-namespace: use blanknamespace for main namespace
Also for target-namespace Bug: T224350 Change-Id: I878b5f7ea1d2cebfc295bf08de372726a580cc28
This commit is contained in:
parent
bf14ce679b
commit
77bcb3a1b1
3 changed files with 25 additions and 8 deletions
|
|
@ -203,7 +203,11 @@ class MovePage {
|
|||
} elseif ( $this->oldTitle->isExternal() ) {
|
||||
$status->fatal( 'immobile-source-namespace-iw' );
|
||||
} elseif ( !$this->oldTitle->isMovable() ) {
|
||||
$status->fatal( 'immobile-source-namespace', $this->oldTitle->getNsText() );
|
||||
$nsText = $this->oldTitle->getNsText();
|
||||
if ( $nsText === '' ) {
|
||||
$nsText = wfMessage( 'blanknamespace' )->text();
|
||||
}
|
||||
$status->fatal( 'immobile-source-namespace', $nsText );
|
||||
} elseif ( !$this->oldTitle->exists() ) {
|
||||
$status->fatal( 'movepage-source-doesnt-exist' );
|
||||
}
|
||||
|
|
@ -211,7 +215,11 @@ class MovePage {
|
|||
if ( $this->newTitle->isExternal() ) {
|
||||
$status->fatal( 'immobile-target-namespace-iw' );
|
||||
} elseif ( !$this->newTitle->isMovable() ) {
|
||||
$status->fatal( 'immobile-target-namespace', $this->newTitle->getNsText() );
|
||||
$nsText = $this->newTitle->getNsText();
|
||||
if ( $nsText === '' ) {
|
||||
$nsText = wfMessage( 'blanknamespace' )->text();
|
||||
}
|
||||
$status->fatal( 'immobile-target-namespace', $nsText );
|
||||
}
|
||||
if ( !$this->newTitle->isValid() ) {
|
||||
$status->fatal( 'movepage-invalid-target-title' );
|
||||
|
|
|
|||
|
|
@ -965,14 +965,22 @@ class PermissionManager {
|
|||
// Check for immobile pages
|
||||
if ( !$this->nsInfo->isMovable( $title->getNamespace() ) ) {
|
||||
// Specific message for this case
|
||||
$errors[] = [ 'immobile-source-namespace', $title->getNsText() ];
|
||||
$nsText = $title->getNsText();
|
||||
if ( $nsText === '' ) {
|
||||
$nsText = wfMessage( 'blanknamespace' )->text();
|
||||
}
|
||||
$errors[] = [ 'immobile-source-namespace', $nsText ];
|
||||
} elseif ( !$title->isMovable() ) {
|
||||
// Less specific message for rarer cases
|
||||
$errors[] = [ 'immobile-source-page' ];
|
||||
}
|
||||
} elseif ( $action == 'move-target' ) {
|
||||
if ( !$this->nsInfo->isMovable( $title->getNamespace() ) ) {
|
||||
$errors[] = [ 'immobile-target-namespace', $title->getNsText() ];
|
||||
$nsText = $title->getNsText();
|
||||
if ( $nsText === '' ) {
|
||||
$nsText = wfMessage( 'blanknamespace' )->text();
|
||||
}
|
||||
$errors[] = [ 'immobile-target-namespace', $nsText ];
|
||||
} elseif ( !$title->isMovable() ) {
|
||||
$errors[] = [ 'immobile-target-page' ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,14 +265,15 @@ class MovePageTest extends MediaWikiTestCase {
|
|||
'Aborted by hook' => [
|
||||
'Hooked in place',
|
||||
'Nonexistent',
|
||||
// @todo Error is wrong
|
||||
[ [ 'immobile-source-namespace', '' ] ],
|
||||
[ [ 'immobile-source-namespace', '(Main)' ] ],
|
||||
],
|
||||
'Doubly aborted by hook' => [
|
||||
'Hooked in place',
|
||||
'Hooked In Place',
|
||||
// @todo Both errors are wrong
|
||||
[ [ 'immobile-source-namespace', '' ], [ 'immobile-target-namespace', '' ] ],
|
||||
[
|
||||
[ 'immobile-source-namespace', '(Main)' ],
|
||||
[ 'immobile-target-namespace', '(Main)' ]
|
||||
],
|
||||
],
|
||||
'Non-file to file' =>
|
||||
[ 'Existent', 'File:Nonexistent.jpg', [ [ 'nonfile-cannot-move-to-file' ] ] ],
|
||||
|
|
|
|||
Loading…
Reference in a new issue