From f6a706c5f498a240f64f3af47543b3abea904aaa Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Fri, 11 Sep 2015 17:26:39 -0700 Subject: [PATCH] Hooks: Respect VisualEditorDisableForAnons for section edit links too Change-Id: I662652e6a2ae6d04c0e6086240fc5ee63194da3a --- VisualEditor.hooks.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index ab6ffb9f61..cd9feab7c0 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -246,6 +246,8 @@ class VisualEditorHooks { public static function onSkinEditSectionLinks( Skin $skin, Title $title, $section, $tooltip, &$result, $lang ) { + $config = ConfigFactory::getDefaultInstance()->makeConfig( 'visualeditor' ); + // Exit if we're in parserTests if ( isset( $GLOBALS[ 'wgVisualEditorInParserTests' ] ) ) { return true; @@ -254,13 +256,13 @@ class VisualEditorHooks { // Exit if the user doesn't have VE enabled if ( !$skin->getUser()->getOption( 'visualeditor-enable' ) || - $skin->getUser()->getOption( 'visualeditor-betatempdisable' ) + $skin->getUser()->getOption( 'visualeditor-betatempdisable' ) || + ( $config->get( 'VisualEditorDisableForAnons' ) && $skin->getUser()->isAnon() ) ) { return true; } - $availableNamespaces = ConfigFactory::getDefaultInstance() - ->makeConfig( 'visualeditor' )->get( 'VisualEditorAvailableNamespaces' ); + $availableNamespaces = $config->get( 'VisualEditorAvailableNamespaces' ); // Exit if we're not in a VE-enabled namespace if ( !$title->inNamespaces( array_keys( array_filter( $availableNamespaces ) ) ) ) { return true; @@ -275,7 +277,6 @@ class VisualEditorHooks { return true; } - $config = ConfigFactory::getDefaultInstance()->makeConfig( 'visualeditor' ); $tabMessages = $config->get( 'VisualEditorTabMessages' ); $veEditSection = $tabMessages['editsection'] !== null ? $tabMessages['editsection'] : 'editsection';