From 553facee1eeb736bf959d02e13744957c8526cc9 Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Mon, 18 Mar 2019 10:51:53 +0100 Subject: [PATCH] Move the throttle help tooltip to a message Follow-up of I982d67aa62a899916a26452aceb9646df8c31232. The help text was meant to be localized, and I probably forgot to do so in the mentioned patch. Change-Id: If394b02819911f9c97519b5c972977c38e6d83fa --- i18n/en.json | 2 ++ i18n/qqq.json | 2 ++ includes/Views/AbuseFilterViewEdit.php | 32 ++++++++++++++++---------- modules/ext.abuseFilter.edit.js | 6 +---- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index b189bfe61..27c99a569 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -200,6 +200,8 @@ "abusefilter-edit-throttle-count": "Number of actions to allow:", "abusefilter-edit-throttle-period": "Period of time (in seconds):", "abusefilter-edit-throttle-groups": "Group throttle by:", + "abusefilter-edit-throttle-groups-help": "See $1.", + "abusefilter-edit-throttle-groups-help-text": "the documentation on mediawiki.org", "abusefilter-edit-throttle-hidden-placeholder": "Split with commas to join with AND, and with linebreaks to join with OR", "abusefilter-edit-throttle-placeholder": "Split with commas to join with AND, and insert one by one to join with OR", "abusefilter-throttle-ip": "IP address", diff --git a/i18n/qqq.json b/i18n/qqq.json index effc1ece1..8903daf29 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -234,6 +234,8 @@ "abusefilter-edit-throttle-count": "Field label for entering the number of allowed hits before triggering the filter consequences.", "abusefilter-edit-throttle-period": "Field label for entering a time period in seconds.\n{{Identical|Second}}", "abusefilter-edit-throttle-groups": "Field label for properties to group throttle counts by (for example IP address and username). Throttling is the concept of limiting occurrences of a certain action in a given time frame.", + "abusefilter-edit-throttle-groups-help": "Message for a help tooltip next to the throttle groups field. Parameters:\n* $1 - A help link, pointing to mediawiki.org.\n\nSee also:\n* {{msg-mw|abusefilter-edit-throttle-groups-help-text}}", + "abusefilter-edit-throttle-groups-help-text": "Text for a help link next to the throttle groups field.\n\nSee also:\n* {{msg-mw|abusefilter-edit-throttle-groups-help}}", "abusefilter-edit-throttle-hidden-placeholder": "Label for a textarea where users may insert throttling criteria.", "abusefilter-edit-throttle-placeholder": "Label for an input field where users may insert throttling criteria.", "abusefilter-throttle-ip": "Throttle option. The first letter is meant to be lowercase.", diff --git a/includes/Views/AbuseFilterViewEdit.php b/includes/Views/AbuseFilterViewEdit.php index 9a1f56c21..e58b6ee9a 100644 --- a/includes/Views/AbuseFilterViewEdit.php +++ b/includes/Views/AbuseFilterViewEdit.php @@ -564,13 +564,17 @@ class AbuseFilterViewEdit extends AbuseFilterView { ] ); - $throttleConfig = [ - 'values' => $throttleGroups, - 'label' => $this->msg( 'abusefilter-edit-throttle-groups' )->parse(), - 'disabled' => $readOnly - ]; - $this->getOutput()->addJsConfigVars( 'throttleConfig', $throttleConfig ); - + $groupsHelpLink = Html::element( + 'a', + [ + 'href' => 'https://www.mediawiki.org/wiki/Special:MyLanguage/' . + 'Extension:AbuseFilter/Actions#Throttling', + 'target' => '_blank' + ], + $this->msg( 'abusefilter-edit-throttle-groups-help-text' )->text() + ); + $groupsHelp = $this->msg( 'abusefilter-edit-throttle-groups-help' ) + ->rawParams( $groupsHelpLink )->escaped(); $hiddenGroups = new OOUI\FieldLayout( new OOUI\MultilineTextInputWidget( [ @@ -589,17 +593,21 @@ class AbuseFilterViewEdit extends AbuseFilterView { ), 'align' => 'top', 'id' => 'mw-abusefilter-hidden-throttle', - 'help' => new OOUI\HtmlSnippet( - 'See ' . - 'mediawiki.org.' - ), + 'help' => new OOUI\HtmlSnippet( $groupsHelp ), 'helpInline' => true ] ); $throttleFields['abusefilter-edit-throttle-groups'] = $hiddenGroups; + $throttleConfig = [ + 'values' => $throttleGroups, + 'label' => $this->msg( 'abusefilter-edit-throttle-groups' )->parse(), + 'disabled' => $readOnly, + 'help' => $groupsHelp + ]; + $this->getOutput()->addJsConfigVars( 'throttleConfig', $throttleConfig ); + $throttleSettings .= Xml::tags( 'div', diff --git a/modules/ext.abuseFilter.edit.js b/modules/ext.abuseFilter.edit.js index ce6728dc5..46cad5c5c 100644 --- a/modules/ext.abuseFilter.edit.js +++ b/modules/ext.abuseFilter.edit.js @@ -407,11 +407,7 @@ align: 'top' }; if ( action === 'throttle' ) { - fieldOpts.help = - new OO.ui.HtmlSnippet( - 'See ' + - 'mediawiki.org.' ); + fieldOpts.help = new OO.ui.HtmlSnippet( config.help ); } field = new OO.ui.FieldLayout( selector, fieldOpts );