mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-13 17:27:20 +00:00
Delegate some switch cases to the parent in GlobalAFPager
af_actions and af_hidden are treated in the same way, so avoid duplicating that code. Some of the remaining cases are also quite similar (although not identical), so we might want to merge them in the future. Change-Id: I1b48502e077e58eb9ff459326bba18bb1d127242
This commit is contained in:
parent
ba5b2fef13
commit
58538103c9
|
@ -31,14 +31,6 @@ class GlobalAbuseFilterPager extends AbuseFilterPager {
|
|||
return $lang->formatNum( intval( $value ) );
|
||||
case 'af_public_comments':
|
||||
return $this->getOutput()->parseInlineAsInterface( $value );
|
||||
case 'af_actions':
|
||||
$actions = explode( ',', $value );
|
||||
$displayActions = [];
|
||||
$context = $this->getContext();
|
||||
foreach ( $actions as $action ) {
|
||||
$displayActions[] = AbuseFilter::getActionDisplay( $action, $context );
|
||||
}
|
||||
return $lang->commaList( $displayActions );
|
||||
case 'af_enabled':
|
||||
$statuses = [];
|
||||
if ( $row->af_deleted ) {
|
||||
|
@ -53,9 +45,6 @@ class GlobalAbuseFilterPager extends AbuseFilterPager {
|
|||
}
|
||||
|
||||
return $lang->commaList( $statuses );
|
||||
case 'af_hidden':
|
||||
$msg = $value ? 'abusefilter-hidden' : 'abusefilter-unhidden';
|
||||
return $this->msg( $msg )->parse();
|
||||
case 'af_hit_count':
|
||||
// If the rule is hidden, don't show it, even to priviledged local admins
|
||||
if ( $row->af_hidden ) {
|
||||
|
@ -76,7 +65,7 @@ class GlobalAbuseFilterPager extends AbuseFilterPager {
|
|||
// If this is global, local name probably doesn't exist, but try
|
||||
return AbuseFilter::nameGroup( $value );
|
||||
default:
|
||||
throw new MWException( "Unknown row type $name!" );
|
||||
return parent::formatValue( $name, $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue