Add optional tracking category for comments in the lede section (before first heading)

The tracking category is disabled by default and has to be
enabled by overriding the localisation message
'MediaWiki:Discussiontools-comments-before-first-heading-category'.

Bug: T324139
Change-Id: I6e4818e9421f76aec814444b2da9f5d8585c75fd
This commit is contained in:
Bartosz Dziewoński 2022-12-07 22:42:41 +01:00
parent d31254005f
commit 18689b370a
4 changed files with 9 additions and 0 deletions

View file

@ -399,6 +399,9 @@
]
}
},
"TrackingCategories": [
"discussiontools-comments-before-first-heading-category"
],
"Hooks": {
"BeforeCreateEchoEvent": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onBeforeCreateEchoEvent",
"EchoGetBundleRules": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onEchoGetBundleRules",

View file

@ -179,6 +179,8 @@
"echo-pref-tooltip-dt-subscription": "Notify me when someone posts a new comment in a topic I am subscribed to.",
"echo-pref-tooltip-dt-subscription-archiving": "Notify me when a topic I am subscribed to is archived or removed from a page, or if notifications about new comments posted in that topic can't be sent for other reasons.",
"minerva-talk-full-page": "Read as wiki page",
"discussiontools-comments-before-first-heading-category": "-",
"discussiontools-comments-before-first-heading-category-desc": "The discussion page contains comments in the lede section (before first heading). This may cause the lede or the comments to be displayed incorrectly, especially in the mobile version and in mobile apps.",
"tag-discussiontools": "-",
"tag-discussiontools-added-comment": "-",
"tag-discussiontools-added-comment-description": "A talk page comment was added in this edit",

View file

@ -193,6 +193,8 @@
"echo-pref-tooltip-dt-subscription": "{{doc-echo-pref-tooltip|title=Echo-category-title-dt-subscription}}",
"echo-pref-tooltip-dt-subscription-archiving": "{{doc-echo-pref-tooltip|title=Echo-category-title-dt-subscription-archiving}}",
"minerva-talk-full-page": "Used as label for link to show the full talk page.",
"discussiontools-comments-before-first-heading-category": "{{ignored}}\n{{tracking category name}}",
"discussiontools-comments-before-first-heading-category-desc": "Tracking category description.",
"tag-discussiontools": "{{ignored}}Short description of the discussiontools tag.\n\nShown on lists of changes (history, recentchanges, etc.) for each edit made using DiscussionTools.\n\nSee also:\n* {{msg-mw|Tag-discussiontools-description}}\n{{Related|tag-discussiontools}}",
"tag-discussiontools-added-comment": "{{ignored}}\nShort description of the discussiontools-added-comment tag.\n\nShown on lists of changes (history, recentchanges, etc.) for each edit that adds a talk page comment (or comments), even if it wasn't made using DiscussionTools.\n\nSee also:\n* {{msg-mw|Tag-discussiontools-added-comment-description}}\n{{Related|tag-discussiontools}}",
"tag-discussiontools-added-comment-description": "Long description of the discussiontools-added-comment tag ({{msg-mw|Tag-discussiontools-added-comment}}).\n\nShown on [[Special:Tags]].\n\nSee also:\n* {{msg-mw|Tag-discussiontools-added-comment}}\n{{Related|tag-discussiontools}}",

View file

@ -314,6 +314,8 @@ class CommentFormatter {
$threadItems[0]->isPlaceholderHeading()
) {
$pout->setExtensionData( 'DiscussionTools-hasCommentsInLedeContent', true );
MediaWikiServices::getInstance()->getTrackingCategories()
->addTrackingCategory( $pout, 'discussiontools-comments-before-first-heading-category', $title );
}
if ( count( $threadItems ) === 0 ) {