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
|
// Blocked user notice
|
||||||
if ( $user->isBlockedFrom( $title, true ) || $user->isBlockedGlobally() ) {
|
if ( $user->isBlockedGlobally() ) {
|
||||||
if ( $user->isBlockedFrom( $title, true ) ) {
|
$block = $user->getGlobalBlock();
|
||||||
$notices[] = [
|
} elseif ( $permissionManager->isBlockedFrom( $user, $title, true ) ) {
|
||||||
'type' => 'block',
|
$block = $user->getBlock();
|
||||||
'message' => call_user_func_array(
|
}
|
||||||
[ $this, 'msg' ],
|
if ( $block ) {
|
||||||
$user->getBlock()->getPermissionsError( $this->getContext() )
|
$notices[] = [
|
||||||
)->parseAsBlock(),
|
'type' => 'block',
|
||||||
];
|
'message' => call_user_func_array(
|
||||||
}
|
[ $this, 'msg' ],
|
||||||
|
$block->getPermissionsError( $this->getContext() )
|
||||||
if ( $user->isBlockedGlobally() ) {
|
)->parseAsBlock(),
|
||||||
$notices[] = [
|
];
|
||||||
'type' => 'block',
|
$blockinfo = ApiQueryUserInfo::getBlockInfo( $block );
|
||||||
'message' => call_user_func_array(
|
|
||||||
[ $this, 'msg' ],
|
|
||||||
$user->getGlobalBlock()->getPermissionsError( $this->getContext() )
|
|
||||||
)->parseAsBlock(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: Build a fake EditPage so we can get checkboxes from it
|
// HACK: Build a fake EditPage so we can get checkboxes from it
|
||||||
|
@ -566,7 +563,7 @@ class ApiVisualEditor extends ApiBase {
|
||||||
'basetimestamp' => $baseTimestamp,
|
'basetimestamp' => $baseTimestamp,
|
||||||
'starttimestamp' => wfTimestampNow(),
|
'starttimestamp' => wfTimestampNow(),
|
||||||
'oldid' => $oldid,
|
'oldid' => $oldid,
|
||||||
|
'blockinfo' => $blockinfo,
|
||||||
];
|
];
|
||||||
if ( $params['paction'] === 'parse' ||
|
if ( $params['paction'] === 'parse' ||
|
||||||
$params['paction'] === 'wikitext' ||
|
$params['paction'] === 'wikitext' ||
|
||||||
|
|
Loading…
Reference in a new issue