Mark hidden tags on Special:Tags and show in RCFilters

Bug: T281741
Change-Id: I8122fdc709427adc4681b463a52530117fabaef3
This commit is contained in:
Bartosz Dziewoński 2021-09-01 02:29:57 +02:00
parent a3892f9df6
commit 0d3fa1d14c
4 changed files with 14 additions and 7 deletions

View file

@ -891,7 +891,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
* *
* Returns an array of associative arrays with information about each tag: * Returns an array of associative arrays with information about each tag:
* - name: Tag name (string) * - name: Tag name (string)
* - labelMsg: Short description message (Message object) * - labelMsg: Short description message (Message object, or false for hidden tags)
* - label: Short description message (raw message contents) * - label: Short description message (raw message contents)
* - descriptionMsg: Long description message (Message object) * - descriptionMsg: Long description message (Message object)
* - description: Long description message (raw message contents) * - description: Long description message (raw message contents)
@ -925,15 +925,11 @@ abstract class ChangesListSpecialPage extends SpecialPage {
$hits > 0 $hits > 0
) { ) {
$labelMsg = ChangeTags::tagShortDescriptionMessage( $tagName, $context ); $labelMsg = ChangeTags::tagShortDescriptionMessage( $tagName, $context );
if ( $labelMsg === false ) {
// Tag is hidden, skip it
continue;
}
$descriptionMsg = ChangeTags::tagLongDescriptionMessage( $tagName, $context ); $descriptionMsg = ChangeTags::tagLongDescriptionMessage( $tagName, $context );
$result[] = [ $result[] = [
'name' => $tagName, 'name' => $tagName,
'labelMsg' => $labelMsg, 'labelMsg' => $labelMsg,
'label' => $labelMsg->plain(), 'label' => $labelMsg ? $labelMsg->plain() : $tagName,
'descriptionMsg' => $descriptionMsg, 'descriptionMsg' => $descriptionMsg,
'description' => $descriptionMsg ? $descriptionMsg->plain() : '', 'description' => $descriptionMsg ? $descriptionMsg->plain() : '',
'cssClass' => Sanitizer::escapeClass( 'mw-tag-' . $tagName ), 'cssClass' => Sanitizer::escapeClass( 'mw-tag-' . $tagName ),
@ -964,7 +960,11 @@ abstract class ChangesListSpecialPage extends SpecialPage {
$language = MediaWikiServices::getInstance()->getLanguageFactory() $language = MediaWikiServices::getInstance()->getLanguageFactory()
->getLanguage( $context->getLanguage() ); ->getLanguage( $context->getLanguage() );
foreach ( $tags as &$tagInfo ) { foreach ( $tags as &$tagInfo ) {
$tagInfo['label'] = Sanitizer::stripAllTags( $tagInfo['labelMsg']->parse() ); if ( $tagInfo['labelMsg'] ) {
$tagInfo['label'] = Sanitizer::stripAllTags( $tagInfo['labelMsg']->parse() );
} else {
$tagInfo['label'] = $context->msg( 'rcfilters-tag-hidden', $tagInfo['name'] )->text();
}
$tagInfo['description'] = $tagInfo['descriptionMsg'] ? $tagInfo['description'] = $tagInfo['descriptionMsg'] ?
$language->truncateForVisual( $language->truncateForVisual(
Sanitizer::stripAllTags( $tagInfo['descriptionMsg']->parse() ), Sanitizer::stripAllTags( $tagInfo['descriptionMsg']->parse() ),

View file

@ -188,6 +188,9 @@ class SpecialTags extends SpecialPage {
$linkRenderer = $this->getLinkRenderer(); $linkRenderer = $this->getLinkRenderer();
$disp = ChangeTags::tagDescription( $tag, $this->getContext() ); $disp = ChangeTags::tagDescription( $tag, $this->getContext() );
if ( $disp === false ) {
$disp = Xml::element( 'em', null, $this->msg( 'tags-hidden' )->text() );
}
if ( $showEditLinks ) { if ( $showEditLinks ) {
$disp .= ' '; $disp .= ' ';
$editLink = $linkRenderer->makeLink( $editLink = $linkRenderer->makeLink(

View file

@ -1502,6 +1502,7 @@
"recentchanges-legend-plusminus": "(<em>±123</em>)", "recentchanges-legend-plusminus": "(<em>±123</em>)",
"recentchanges-legend-watchlistexpiry": "Temporarily watched page", "recentchanges-legend-watchlistexpiry": "Temporarily watched page",
"recentchanges-submit": "Show", "recentchanges-submit": "Show",
"rcfilters-tag-hidden": "$1 (hidden tag)",
"rcfilters-tag-remove": "Remove '$1'", "rcfilters-tag-remove": "Remove '$1'",
"rcfilters-legend-heading": "<strong>List of abbreviations:</strong>", "rcfilters-legend-heading": "<strong>List of abbreviations:</strong>",
"rcfilters-other-review-tools": "Other review tools", "rcfilters-other-review-tools": "Other review tools",
@ -3791,6 +3792,7 @@
"tags-source-extension": "Defined by the software", "tags-source-extension": "Defined by the software",
"tags-source-manual": "Applied manually by users and bots", "tags-source-manual": "Applied manually by users and bots",
"tags-source-none": "No longer in use", "tags-source-none": "No longer in use",
"tags-hidden": "(hidden)",
"tags-edit": "edit", "tags-edit": "edit",
"tags-delete": "delete", "tags-delete": "delete",
"tags-activate": "activate", "tags-activate": "activate",

View file

@ -1727,6 +1727,7 @@
"recentchanges-legend-plusminus": "{{optional}}\nA plus/minus sign with a number for the legend.", "recentchanges-legend-plusminus": "{{optional}}\nA plus/minus sign with a number for the legend.",
"recentchanges-legend-watchlistexpiry": "Used as legend on [[Special:Watchlist]], next to an icon of a clock indicating that a watchlist item is temporarily watched.", "recentchanges-legend-watchlistexpiry": "Used as legend on [[Special:Watchlist]], next to an icon of a clock indicating that a watchlist item is temporarily watched.",
"recentchanges-submit": "Label for submit button in [[Special:RecentChanges]]\n{{Identical|Show}}", "recentchanges-submit": "Label for submit button in [[Special:RecentChanges]]\n{{Identical|Show}}",
"rcfilters-tag-hidden": "Label used in a dropdown listing all available tags, when the tag has no human-readable name, because it is ''hidden'' (not shown on histories, recent changes, diffs, etc.).\n\nParameters:\n$1 - internal tag name (usually in English)",
"rcfilters-tag-remove": "A tooltip for the button that removes a filter from the active filters area in [[Special:RecentChanges]] and [[Special:Watchlist]] when RCFilters are enabled. \n\nParameters: $1 - Tag label\n{{Identical|Remove}}", "rcfilters-tag-remove": "A tooltip for the button that removes a filter from the active filters area in [[Special:RecentChanges]] and [[Special:Watchlist]] when RCFilters are enabled. \n\nParameters: $1 - Tag label\n{{Identical|Remove}}",
"rcfilters-legend-heading": "Used as a heading for legend box on [[Special:RecentChanges]] and [[Special:Watchlist]] when RCFilters are enabled.", "rcfilters-legend-heading": "Used as a heading for legend box on [[Special:RecentChanges]] and [[Special:Watchlist]] when RCFilters are enabled.",
"rcfilters-other-review-tools": "Used as a heading for the community collection of other links on [[Special:RecentChanges]] when RCFilters are enabled.", "rcfilters-other-review-tools": "Used as a heading for the community collection of other links on [[Special:RecentChanges]] when RCFilters are enabled.",
@ -4016,6 +4017,7 @@
"tags-source-extension": "Table cell contents if given tag can be applied automatically by the MediaWiki software.\n\nSee also:\n* {{msg-mw|Tags-source-manual}}\n* {{msg-mw|Tags-source-none}}", "tags-source-extension": "Table cell contents if given tag can be applied automatically by the MediaWiki software.\n\nSee also:\n* {{msg-mw|Tags-source-manual}}\n* {{msg-mw|Tags-source-none}}",
"tags-source-manual": "\"Applied\" is not past tense, but an adjective that describes an action that sometimes happens, as in the sentence: \"(this tag is usually) applied by users and bots\".\n\nTable cell contents if given tag can be applied by users or bots.\n\nSee also:\n* {{msg-mw|Tags-source-extension}}\n* {{msg-mw|Tags-source-none}}", "tags-source-manual": "\"Applied\" is not past tense, but an adjective that describes an action that sometimes happens, as in the sentence: \"(this tag is usually) applied by users and bots\".\n\nTable cell contents if given tag can be applied by users or bots.\n\nSee also:\n* {{msg-mw|Tags-source-extension}}\n* {{msg-mw|Tags-source-none}}",
"tags-source-none": "Table cell contents if given tag is no longer in use. (It was applied in the past, but it is currently not applied.)\n\nSee also:\n* {{msg-mw|Tags-source-extension}}\n* {{msg-mw|Tags-source-manual}}", "tags-source-none": "Table cell contents if given tag is no longer in use. (It was applied in the past, but it is currently not applied.)\n\nSee also:\n* {{msg-mw|Tags-source-extension}}\n* {{msg-mw|Tags-source-manual}}",
"tags-hidden": "Table cell contents if given tag is hidden (not shown on histories, recent changes, diffs, etc.)",
"tags-edit": "Used on [[Special:Tags]]. Verb. Used as display text on a link to create/edit a description.\n{{Identical|Edit}}", "tags-edit": "Used on [[Special:Tags]]. Verb. Used as display text on a link to create/edit a description.\n{{Identical|Edit}}",
"tags-delete": "Used on [[Special:Tags]]. Verb. Used as display text on a link to delete a tag.\n{{Identical|Delete}}", "tags-delete": "Used on [[Special:Tags]]. Verb. Used as display text on a link to delete a tag.\n{{Identical|Delete}}",
"tags-activate": "Used on [[Special:Tags]]. Verb. Used as display text on a link to activate a tag.\n{{Identical|Activate}}", "tags-activate": "Used on [[Special:Tags]]. Verb. Used as display text on a link to activate a tag.\n{{Identical|Activate}}",