From 58538103c92f292f139fcb174ae1ea99d9ee098a Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Wed, 7 Oct 2020 12:45:09 +0200 Subject: [PATCH] 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 --- includes/pagers/GlobalAbuseFilterPager.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/includes/pagers/GlobalAbuseFilterPager.php b/includes/pagers/GlobalAbuseFilterPager.php index 17a6e890d..d6941a897 100644 --- a/includes/pagers/GlobalAbuseFilterPager.php +++ b/includes/pagers/GlobalAbuseFilterPager.php @@ -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 ); } } }