Introduce a 'mobile-ab' config option for section editing

This enables mobile section editing if the user is logged
in and has an odd user ID. Otherwise it is disabled.

Bug: T218851
Change-Id: I2c22d7636ae11d2db7780ae5adb3abe9df532b7c
This commit is contained in:
Ed Sanders 2019-03-21 13:18:10 +00:00
parent 7e3e7e9c5a
commit d6d48ff4b8

View file

@ -55,6 +55,15 @@
}
}
// T218851: Section editing A/B test
if ( conf.enableVisualSectionEditing === 'mobile-ab' ) {
if ( !mw.user.isAnon() && mw.user.getId() % 2 ) {
conf.enableVisualSectionEditing = 'mobile';
} else {
conf.enableVisualSectionEditing = false;
}
}
mw.libs.ve = mw.libs.ve || {};
mw.libs.ve.targetLoader = {
@ -134,7 +143,7 @@
if ( sessionState ) {
request = sessionState.request || {};
// Check true section editing is in use
enableVisualSectionEditing = mw.config.get( 'wgVisualEditorConfig' ).enableVisualSectionEditing;
enableVisualSectionEditing = conf.enableVisualSectionEditing;
section = request.mode === 'source' || enableVisualSectionEditing === true || enableVisualSectionEditing === options.targetName ?
options.section : null;
// Check the requested page, mode and section match the stored one