Merge "Move the throttle help tooltip to a message"

This commit is contained in:
jenkins-bot 2019-03-22 10:35:02 +00:00 committed by Gerrit Code Review
commit c8021a520a
4 changed files with 25 additions and 17 deletions

View file

@ -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",

View file

@ -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.",

View file

@ -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 <a href="https://www.mediawiki.org/wiki/Special:MyLanguage/' .
'Extension:AbuseFilter/Actions#Throttling" target="_blank">' .
'mediawiki.org</a>.'
),
'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',

View file

@ -407,11 +407,7 @@
align: 'top'
};
if ( action === 'throttle' ) {
fieldOpts.help =
new OO.ui.HtmlSnippet(
'See <a href="https://www.mediawiki.org/wiki/Special:MyLanguage/' +
'Extension:AbuseFilter/Actions#Throttling" target="_blank">' +
'mediawiki.org</a>.' );
fieldOpts.help = new OO.ui.HtmlSnippet( config.help );
}
field = new OO.ui.FieldLayout( selector, fieldOpts );