mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-15 02:03:58 +00:00
Merge "Update for API error i18n"
This commit is contained in:
commit
087a0e7733
|
@ -132,15 +132,12 @@ class TitleBlacklistHooks {
|
|||
$blacklisted = $titleBlacklist->userCannot( $oldTitle, $user, 'edit' );
|
||||
}
|
||||
if ( $blacklisted instanceof TitleBlacklistEntry ) {
|
||||
$errmsg = $blacklisted->getErrorMessage( 'move' );
|
||||
ApiBase::$messageMap[$errmsg] = array(
|
||||
'code' => $errmsg,
|
||||
'info' => 'TitleBlacklist prevents this new title from being created or old title from being edited'
|
||||
);
|
||||
$status->fatal( $errmsg,
|
||||
$status->fatal( ApiMessage::create( [
|
||||
$blacklisted->getErrorMessage( 'move' ),
|
||||
$blacklisted->getRaw(),
|
||||
$oldTitle->getFullText(),
|
||||
$newTitle->getFullText() );
|
||||
$newTitle->getFullText()
|
||||
] ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,11 @@ class ApiQueryTitleBlacklist extends ApiBase {
|
|||
|
||||
$title = Title::newFromText( $params['title'] );
|
||||
if ( !$title ) {
|
||||
$this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
|
||||
if ( is_callable( [ $this, 'dieWithError' ] ) ) {
|
||||
$this->dieWithError( array( 'apierror-invalidtitle', wfEscapeWikiText( $params['title'] ) ) );
|
||||
} else {
|
||||
$this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
$blacklisted = TitleBlacklist::singleton()->userCannot( $title, $this->getUser(), $action, $override );
|
||||
|
|
Loading…
Reference in a new issue