Add the ListToggle to Special:AbuseLog for users who can hide entries

Add the ListToggle provided in core's ListToggle.php to
Special:AbuseLog when a list of abuse filter entries are being
shown and the user can hide abuse filter entries. This will allow
them to select multiple checkboxes to hide at once (without having
to shift and selecting the first and last).

Bug: T311954
Change-Id: I1aa4fa3fa7016a5d9ae4a904c151011743d2c8ed
This commit is contained in:
dreamyjazz 2022-07-03 16:52:28 +01:00
parent 2709583b52
commit 13e6c1c06a

View file

@ -8,6 +8,7 @@ use Html;
use HTMLForm;
use InvalidArgumentException;
use Linker;
use ListToggle;
use ManualLogEntry;
use MediaWiki\Cache\LinkBatchFactory;
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager;
@ -623,9 +624,9 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage {
'method' => 'GET',
'action' => $this->getPageTitle( 'hide' )->getLocalURL()
],
$this->getDeleteButton() .
$this->getDeleteButton() . $this->getListToggle() .
Xml::tags( 'ul', [ 'class' => 'plainlinks' ], $pager->getBody() ) .
$this->getDeleteButton()
$this->getListToggle() . $this->getDeleteButton()
);
if ( $result && $result->numRows() !== 0 ) {
@ -650,6 +651,19 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage {
] );
}
/**
* Get the All / Invert / None options provided by
* ToggleList.php to mass select the checkboxes.
*
* @return string
*/
private function getListToggle() {
if ( !$this->afPermissionManager->canHideAbuseLog( $this->getUser() ) ) {
return '';
}
return ( new ListToggle( $this->getOutput() ) )->getHtml();
}
/**
* @param string|int $id
* @suppress SecurityCheck-SQLInjection