mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-23 22:13:34 +00:00
getPreferredEditor() shouldn't return VisualEditor if it's disabled by the user
Bug: T257234 Change-Id: I68002cc7bf6935bad705497df6531e3611bd2ca6
This commit is contained in:
parent
4ea0cf0cab
commit
b819b8a657
|
@ -365,6 +365,13 @@ class VisualEditorHooks {
|
|||
public static function getPreferredEditor(
|
||||
User $user, WebRequest $req, $useWikitextInMultiTab = false
|
||||
) {
|
||||
// VisualEditor shouldn't even call this method when it's disabled, but it is a public API for
|
||||
// other extensions (e.g. DiscussionTools), and the editor preferences might have surprising
|
||||
// values if the user has tried VisualEditor in the past and then disabled it. (T257234)
|
||||
if ( !self::enabledForUser( $user ) ) {
|
||||
return 'wikitext';
|
||||
}
|
||||
|
||||
switch ( $user->getOption( 'visualeditor-tabs' ) ) {
|
||||
case 'prefer-ve':
|
||||
return 'visualeditor';
|
||||
|
|
Loading…
Reference in a new issue