mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 10:48:42 +00:00
Merge "Track when block notices are returned on the api"
This commit is contained in:
commit
44fcea9f65
|
@ -98,7 +98,8 @@
|
|||
]
|
||||
},
|
||||
"VisualEditorEnableTocWidget": false,
|
||||
"VisualEditorRebaserURL": false
|
||||
"VisualEditorRebaserURL": false,
|
||||
"VisualEditorTrackBlockNotices": false
|
||||
},
|
||||
"APIModules": {
|
||||
"visualeditor": {
|
||||
|
|
|
@ -523,22 +523,25 @@ class ApiVisualEditor extends ApiBase {
|
|||
}
|
||||
|
||||
// Blocked user notice
|
||||
if (
|
||||
$user->isBlockedFrom( $title, true ) &&
|
||||
$user->getBlock()->prevents( 'edit' ) !== false
|
||||
) {
|
||||
$notices[] = call_user_func_array(
|
||||
[ $this, 'msg' ],
|
||||
$user->getBlock()->getPermissionsError( $this->getContext() )
|
||||
)->parseAsBlock();
|
||||
}
|
||||
if ( $user->isBlockedFrom( $title, true ) || $user->isBlockedGlobally() ) {
|
||||
if ( $user->isBlockedFrom( $title, true ) ) {
|
||||
$notices[] = call_user_func_array(
|
||||
[ $this, 'msg' ],
|
||||
$user->getBlock()->getPermissionsError( $this->getContext() )
|
||||
)->parseAsBlock();
|
||||
}
|
||||
|
||||
// Blocked user notice for global blocks
|
||||
if ( $user->isBlockedGlobally() ) {
|
||||
$notices[] = call_user_func_array(
|
||||
[ $this, 'msg' ],
|
||||
$user->getGlobalBlock()->getPermissionsError( $this->getContext() )
|
||||
)->parseAsBlock();
|
||||
if ( $user->isBlockedGlobally() ) {
|
||||
$notices[] = call_user_func_array(
|
||||
[ $this, 'msg' ],
|
||||
$user->getGlobalBlock()->getPermissionsError( $this->getContext() )
|
||||
)->parseAsBlock();
|
||||
}
|
||||
|
||||
if ( $this->veConfig->get( 'VisualEditorTrackBlockNotices' ) ) {
|
||||
$statsd = MediaWikiServices::getInstance()->getStatsdDataFactory();
|
||||
$statsd->increment( 'MediaWiki.BlockNotices.' . wfWikiID() . '.VisualEditor.returned' );
|
||||
}
|
||||
}
|
||||
|
||||
// HACK: Build a fake EditPage so we can get checkboxes from it
|
||||
|
|
Loading…
Reference in a new issue