mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Merge "ApiVisualEditor: Return structured block info as well as formatted notice"
This commit is contained in:
commit
78a0b4ea0f
|
@ -487,27 +487,24 @@ class ApiVisualEditor extends ApiBase {
|
|||
}
|
||||
}
|
||||
|
||||
$block = null;
|
||||
$blockinfo = null;
|
||||
$permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
|
||||
// Blocked user notice
|
||||
if ( $user->isBlockedFrom( $title, true ) || $user->isBlockedGlobally() ) {
|
||||
if ( $user->isBlockedFrom( $title, true ) ) {
|
||||
$notices[] = [
|
||||
'type' => 'block',
|
||||
'message' => call_user_func_array(
|
||||
[ $this, 'msg' ],
|
||||
$user->getBlock()->getPermissionsError( $this->getContext() )
|
||||
)->parseAsBlock(),
|
||||
];
|
||||
}
|
||||
|
||||
if ( $user->isBlockedGlobally() ) {
|
||||
$block = $user->getGlobalBlock();
|
||||
} elseif ( $permissionManager->isBlockedFrom( $user, $title, true ) ) {
|
||||
$block = $user->getBlock();
|
||||
}
|
||||
if ( $block ) {
|
||||
$notices[] = [
|
||||
'type' => 'block',
|
||||
'message' => call_user_func_array(
|
||||
[ $this, 'msg' ],
|
||||
$user->getGlobalBlock()->getPermissionsError( $this->getContext() )
|
||||
$block->getPermissionsError( $this->getContext() )
|
||||
)->parseAsBlock(),
|
||||
];
|
||||
}
|
||||
$blockinfo = ApiQueryUserInfo::getBlockInfo( $block );
|
||||
}
|
||||
|
||||
// HACK: Build a fake EditPage so we can get checkboxes from it
|
||||
|
@ -566,7 +563,7 @@ class ApiVisualEditor extends ApiBase {
|
|||
'basetimestamp' => $baseTimestamp,
|
||||
'starttimestamp' => wfTimestampNow(),
|
||||
'oldid' => $oldid,
|
||||
|
||||
'blockinfo' => $blockinfo,
|
||||
];
|
||||
if ( $params['paction'] === 'parse' ||
|
||||
$params['paction'] === 'wikitext' ||
|
||||
|
|
Loading…
Reference in a new issue