From fe03de6e4fb3fd6f9211560cb2a2491a5a019215 Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Thu, 24 Jan 2019 12:58:41 +0100 Subject: [PATCH] Add help links for throttle groups Several people have reported throttle groups being hard to use, mostly because the field doesn't have options with the usable groups. This is because users can combine valid groups in many ways, and thus we don't provide options. However, let's add an help link pointing to mw.org. Change-Id: I982d67aa62a899916a26452aceb9646df8c31232 --- includes/Views/AbuseFilterViewEdit.php | 8 +++++++- modules/ext.abuseFilter.edit.js | 24 +++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/includes/Views/AbuseFilterViewEdit.php b/includes/Views/AbuseFilterViewEdit.php index b64d2be08..ea15dcf34 100644 --- a/includes/Views/AbuseFilterViewEdit.php +++ b/includes/Views/AbuseFilterViewEdit.php @@ -590,7 +590,13 @@ class AbuseFilterViewEdit extends AbuseFilterView { $this->msg( 'abusefilter-edit-throttle-groups' )->parse() ), 'align' => 'top', - 'id' => 'mw-abusefilter-hidden-throttle' + 'id' => 'mw-abusefilter-hidden-throttle', + 'help' => new OOUI\HtmlSnippet( + 'See ' . + 'mediawiki.org.' + ), + 'helpInline' => true ] ); diff --git a/modules/ext.abuseFilter.edit.js b/modules/ext.abuseFilter.edit.js index b4d03a765..bd643d22e 100644 --- a/modules/ext.abuseFilter.edit.js +++ b/modules/ext.abuseFilter.edit.js @@ -390,7 +390,7 @@ $container = $( '#mw-abusefilter-' + action + '-parameters' ), // Character used to separate elements in the textarea. separator = action === 'throttle' ? '\n' : ',', - selector, field, hiddenField; + selector, field, fieldOpts, hiddenField; selector = new OO.ui.TagMultiselectWidget( { @@ -402,14 +402,20 @@ placeholder: OO.ui.msg( 'abusefilter-edit-' + action + '-placeholder' ), disabled: disabled } ); - field = - new OO.ui.FieldLayout( - selector, - { - label: $( $.parseHTML( config.label ) ), - align: 'top' - } - ); + + fieldOpts = { + label: $( $.parseHTML( config.label ) ), + align: 'top' + }; + if ( action === 'throttle' ) { + fieldOpts.help = + new OO.ui.HtmlSnippet( + 'See ' + + 'mediawiki.org.' ); + } + + field = new OO.ui.FieldLayout( selector, fieldOpts ); // mw-abusefilter-hidden-throttle-field, mw-abusefilter-hidden-tag-field hiddenField = OO.ui.infuse( $( '#mw-abusefilter-hidden-' + action + '-field' ) );