Merge "immobile-source-namespace: use blanknamespace for main namespace"
This commit is contained in:
commit
8cbf108de7
3 changed files with 25 additions and 8 deletions
|
|
@ -217,7 +217,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' );
|
||||
}
|
||||
|
|
@ -225,7 +229,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' );
|
||||
|
|
|
|||
|
|
@ -970,14 +970,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