Hooks: Support auto-enabling for auto-created accounts

Change-Id: Ibe1ba94e4478a637367b303b479586f45e85cfa4
This commit is contained in:
James D. Forrester 2015-07-16 09:13:41 -05:00
parent 43eb3493a8
commit 2429c5fcb2
2 changed files with 23 additions and 0 deletions

View file

@ -721,4 +721,23 @@ class VisualEditorHooks {
}
return true;
}
/**
* Sets user preference to enable the VisualEditor account for new auto-
* created ('auth') accounts, if $wgVisualEditorAutoAccountEnable is set.
*
* To be removed once no longer needed.
*/
public static function onAuthPluginAutoCreate( $user ) {
if (
RequestContext::getMain()->getConfig()->get( 'VisualEditorAutoAccountEnable' ) &&
$user->isLoggedin()
) {
$user->setOption( 'visualeditor-enable', 1 );
$user->saveSettings();
}
return true;
}
}

View file

@ -96,6 +96,7 @@
"VisualEditorParsoidURL": "http://localhost:8000",
"VisualEditorEnableSplitTest": false,
"VisualEditorEnableTocWidget": false,
"VisualEditorAutoAccountEnable": false,
"VisualEditorNamespaces": [],
"VisualEditorParsoidTimeout": 100
},
@ -170,6 +171,9 @@
],
"AddNewAccount": [
"VisualEditorHooks::onAddNewAccount"
],
"AuthPluginAutoCreate": [
"VisualEditorHooks::onAuthPluginAutoCreate"
]
},
"ResourceModules": {