mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-23 18:28:51 +00:00
Merge "Re-add A/B testing framework for new accounts"
This commit is contained in:
commit
84b236ef95
|
@ -652,4 +652,22 @@ class VisualEditorHooks {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets user preference to enable the VisualEditor account if their new
|
||||
* account's userID is even, if $wgVisualEditorEnableSplitTest is true.
|
||||
*
|
||||
* To be removed once no longer needed.
|
||||
*/
|
||||
public static function onAddNewAccount( $user, $byEmail ) {
|
||||
if (
|
||||
RequestContext::getMain()->getConfig()->get( 'VisualEditorEnableSplitTest' ) &&
|
||||
$user->isLoggedin() &&
|
||||
( ( $user->getId() % 2 ) === 0 )
|
||||
) {
|
||||
$user->setOption( 'visualeditor-enable', 1 );
|
||||
$user->saveSettings();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,9 @@ $wgHooks['PageContentSaveComplete'][] = 'VisualEditorHooks::onPageContentSaveCom
|
|||
$wgHooks['BeforeInitialize'][] = 'VisualEditorHooks::onBeforeInitialize';
|
||||
$wgExtensionFunctions[] = 'VisualEditorHooks::onSetup';
|
||||
|
||||
// Run split test in production if $wgVisualEditorEnableSplitTest is true.
|
||||
$wgHooks['AddNewAccount'][] = 'VisualEditorHooks::onAddNewAccount';
|
||||
|
||||
// Register resource modules
|
||||
|
||||
$wgVisualEditorResourceTemplate = array(
|
||||
|
@ -1712,4 +1715,7 @@ $wgVisualEditorTabMessages = array(
|
|||
'editsectionsourceappendix' => null,
|
||||
);
|
||||
|
||||
// Whether to enable VisualEditor for half of all new accounts (userID even).
|
||||
$wgVisualEditorEnableSplitTest = false;
|
||||
|
||||
unset( $wgVisualEditorResourceTemplate );
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
},
|
||||
"VisualEditorTabPosition": "before",
|
||||
"VisualEditorParsoidURL": "http://localhost:8000",
|
||||
"VisualEditorEnableSplitTest": false,
|
||||
"VisualEditorEnableTocWidget": false,
|
||||
"VisualEditorNamespaces": [],
|
||||
"VisualEditorParsoidTimeout": 100
|
||||
|
@ -165,6 +166,9 @@
|
|||
],
|
||||
"BeforeInitialize": [
|
||||
"VisualEditorHooks::onBeforeInitialize"
|
||||
],
|
||||
"AddNewAccount": [
|
||||
"VisualEditorHooks::onAddNewAccount"
|
||||
]
|
||||
},
|
||||
"ResourceModules": {
|
||||
|
|
Loading…
Reference in a new issue