Merge "Ignore user prefs for enabling/disabling VE which are not settable"

This commit is contained in:
jenkins-bot 2021-02-11 00:31:26 +00:00 committed by Gerrit Code Review
commit 6392fda0f0
2 changed files with 9 additions and 3 deletions

View file

@ -238,8 +238,13 @@ class VisualEditorHooks {
* @return bool
*/
private static function enabledForUser( $user ) {
return $user->getOption( 'visualeditor-enable' ) &&
!$user->getOption( 'visualeditor-betatempdisable' ) &&
$veConfig = MediaWikiServices::getInstance()->getConfigFactory()
->makeConfig( 'visualeditor' );
$isBeta = $veConfig->get( 'VisualEditorEnableBetaFeature' );
return ( $isBeta ?
$user->getOption( 'visualeditor-enable' ) :
!$user->getOption( 'visualeditor-betatempdisable' ) ) &&
!$user->getOption( 'visualeditor-autodisable' );
}
@ -1006,6 +1011,7 @@ class VisualEditorHooks {
$vars['wgVisualEditorConfig'] = [
'usePageImages' => $extensionRegistry->isLoaded( 'PageImages' ),
'usePageDescriptions' => $extensionRegistry->isLoaded( 'WikibaseClient' ),
'isBeta' => $veConfig->get( 'VisualEditorEnableBetaFeature' ),
'disableForAnons' => $veConfig->get( 'VisualEditorDisableForAnons' ),
'preloadModules' => $veConfig->get( 'VisualEditorPreloadModules' ),
'preferenceModules' => $veConfig->get( 'VisualEditorPreferenceModules' ),

View file

@ -1174,7 +1174,7 @@
// User has 'visualeditor-enable' preference enabled (for alpha opt-in)
// User has 'visualeditor-betatempdisable' preference disabled
// User has 'visualeditor-autodisable' preference disabled
enable && !tempdisable && !autodisable
( conf.isBeta ? enable : !tempdisable ) && !autodisable
);
// Duplicated in VisualEditor.hooks.php#isVisualAvailable()