diff --git a/includes/Hooks.php b/includes/Hooks.php index 7485ff905..c40edc761 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -267,6 +267,14 @@ class Hooks { 'ext.discussionTools.init' ] ); + $output->addJsConfigVars( + 'wgDiscussionToolsFeaturesEnabled', + [ + 'replytool' => static::isFeatureEnabledForOutput( $output, 'replytool' ), + 'newtopictool' => static::isFeatureEnabledForOutput( $output, 'newtopictool' ), + ] + ); + $services = MediaWikiServices::getInstance(); $optionsLookup = $services->getUserOptionsLookup(); $req = $output->getRequest(); diff --git a/modules/controller.js b/modules/controller.js index 11e1e7b3c..eabcd9c92 100644 --- a/modules/controller.js +++ b/modules/controller.js @@ -4,6 +4,7 @@ var $pageContainer, newTopicController, $overlay, + featuresEnabled = mw.config.get( 'wgDiscussionToolsFeaturesEnabled' ), Parser = require( './Parser.js' ), ThreadItem = require( './ThreadItem.js' ), logger = require( './logger.js' ), @@ -276,7 +277,7 @@ function init( $container, state ) { } } - if ( mw.user.options.get( 'discussiontools-newtopictool' ) ) { + if ( featuresEnabled.newtopictool && mw.user.options.get( 'discussiontools-newtopictool' ) ) { if ( newTopicController ) { // Stop the torn down controller from re-appearing newTopicController.$replyLink.off( 'click keypress', newTopicController.onReplyLinkClickHandler );