mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Merge "Hooks: Respect VisualEditorDisableForAnons for section edit links too"
This commit is contained in:
commit
66dd0e2610
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue