mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-30 17:14:42 +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(
|
public static function getPreferredEditor(
|
||||||
User $user, WebRequest $req, $useWikitextInMultiTab = false
|
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' ) ) {
|
switch ( $user->getOption( 'visualeditor-tabs' ) ) {
|
||||||
case 'prefer-ve':
|
case 'prefer-ve':
|
||||||
return 'visualeditor';
|
return 'visualeditor';
|
||||||
|
|
Loading…
Reference in a new issue