Merge "Allow visualenhancements on pages with __NEWSECTIONLINK__"

This commit is contained in:
jenkins-bot 2023-03-15 20:24:19 +00:00 committed by Gerrit Code Review
commit 2185ac1ca3
2 changed files with 16 additions and 2 deletions

View file

@ -534,6 +534,10 @@
"description": "A list of language codes which will receive an icon in their enhanced reply-button treatment", "description": "A list of language codes which will receive an icon in their enhanced reply-button treatment",
"merge_strategy": "provide_default" "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": { "DiscussionToolsEnablePermalinksBackend": {
"value": true, "value": true,
"description": "Enable the permalinks backend. Do not enable this unless the database tables exist." "description": "Enable the permalinks backend. Do not enable this unless the database tables exist."

View file

@ -352,8 +352,18 @@ class HookUtils {
$services = MediaWikiServices::getInstance(); $services = MediaWikiServices::getInstance();
if ( $feature === static::VISUALENHANCEMENTS ) { if ( $feature === static::VISUALENHANCEMENTS ) {
// Visual enhancements are only enabled on talk namespaces (T325417) $dtConfig = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'discussiontools' );
return $title->isTalkPage(); // 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. // Check that the page supports discussions.