diff --git a/extension.json b/extension.json index dcf95aca9..6737db2ff 100644 --- a/extension.json +++ b/extension.json @@ -534,6 +534,10 @@ "description": "A list of language codes which will receive an icon in their enhanced reply-button treatment", "merge_strategy": "provide_default" }, + "DiscussionTools_visualenhancements_newsectionlink_enable": { + "value": true, + "description": "Enable visual enhancements on non-talk, non-article namespaces if they have __NEWSECTIONLINK__ magic word. Temporary config for phased rollout (T331635)" + }, "DiscussionToolsEnablePermalinksBackend": { "value": true, "description": "Enable the permalinks backend. Do not enable this unless the database tables exist." diff --git a/includes/Hooks/HookUtils.php b/includes/Hooks/HookUtils.php index daf2236f7..00caeea39 100644 --- a/includes/Hooks/HookUtils.php +++ b/includes/Hooks/HookUtils.php @@ -352,8 +352,18 @@ class HookUtils { $services = MediaWikiServices::getInstance(); if ( $feature === static::VISUALENHANCEMENTS ) { - // Visual enhancements are only enabled on talk namespaces (T325417) - return $title->isTalkPage(); + $dtConfig = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'discussiontools' ); + // Visual enhancements are only enabled on talk namespaces (T325417) ... + return $title->isTalkPage() || ( + $dtConfig->get( 'DiscussionTools_visualenhancements_newsectionlink_enable' ) && + // ... or __NEWSECTIONLINK__ pages (T331635) + static::hasPagePropCached( $title, 'newsectionlink' ) && + // excluding the main namespace, unless it has been configured for signatures + ( + $title->getNamespace() !== NS_MAIN || + $services->getNamespaceInfo()->wantSignatures( $title->getNamespace() ) + ) + ); } // Check that the page supports discussions.