mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-23 14:06:52 +00:00
Merge "Enrollment for the edit check a/b test"
This commit is contained in:
commit
8d70615b5e
|
@ -154,6 +154,10 @@
|
|||
"value": false,
|
||||
"description": "Enable experimental Edit Check feature. Can also be enabled using ?ecenable=1."
|
||||
},
|
||||
"VisualEditorEditCheckABTest": {
|
||||
"value": false,
|
||||
"description": "A/B test Edit Check for all users. A/B bucket status will override VisualEditorEditCheck."
|
||||
},
|
||||
"VisualEditorUseSingleEditTab": {
|
||||
"value": false
|
||||
}
|
||||
|
|
|
@ -1176,6 +1176,7 @@ class Hooks implements
|
|||
'useChangeTagging' => $veConfig->get( 'VisualEditorUseChangeTagging' ),
|
||||
'editCheckTagging' => $veConfig->get( 'VisualEditorEditCheckTagging' ),
|
||||
'editCheck' => $veConfig->get( 'VisualEditorEditCheck' ),
|
||||
'editCheckABTest' => $veConfig->get( 'VisualEditorEditCheckABTest' ),
|
||||
'namespacesWithSubpages' => $namespacesWithSubpagesEnabled,
|
||||
'specialBooksources' => urldecode( SpecialPage::getTitleFor( 'Booksources' )->getPrefixedURL() ),
|
||||
'rebaserUrl' => $coreConfig->get( 'VisualEditorRebaserURL' ),
|
||||
|
|
|
@ -37,6 +37,23 @@
|
|||
modules.push( 'ext.visualEditor.mwwikitext' );
|
||||
}
|
||||
|
||||
// A/B test enrollment for edit check (T342930)
|
||||
if ( conf.editCheckABTest ) {
|
||||
var inABTest;
|
||||
if ( mw.user.isAnon() ) {
|
||||
// can't just use mw.user.sessionId() because we need this to last across sessions
|
||||
var token = mw.cookie.get( 'VEECid', '', mw.user.generateRandomSessionId() );
|
||||
// Store the token so our state is consistent across pages
|
||||
mw.cookie.set( 'VEECid', token, { path: '/', expires: 90 * 86400, prefix: '' } );
|
||||
inABTest = parseInt( token.slice( 0, 8 ), 16 ) % 2 === 1;
|
||||
} else {
|
||||
inABTest = mw.user.getId() % 2 === 1;
|
||||
}
|
||||
conf.editCheck = inABTest;
|
||||
// Communicate the bucket to instrumentation:
|
||||
mw.config.set( 'wgVisualEditorEditCheckABTestBucket', '2024-02-editcheck-reference-' + ( inABTest ? 'test' : 'control' ) );
|
||||
}
|
||||
|
||||
var editCheck = conf.editCheck || !!url.searchParams.get( 'ecenable' ) || !!window.MWVE_FORCE_EDIT_CHECK_ENABLED;
|
||||
if ( conf.editCheckTagging || editCheck ) {
|
||||
modules.push( 'ext.visualEditor.editCheck' );
|
||||
|
|
Loading…
Reference in a new issue