Filter parameters when loading/editing them

Re-opening of I8eb50d38c81b4e446c0f1dc03abc27122b8fa025 by Thiemo Kreuz.

Bug: T189681
Change-Id: Iaeae672dca66ffc745054daabd6f0eae7dfbc648
This commit is contained in:
Daimona Eaytoy 2018-04-04 13:46:58 +02:00 committed by Huji
parent fb9b947a67
commit 392f37d516
2 changed files with 3 additions and 3 deletions

View file

@ -805,7 +805,7 @@ class AbuseFilter {
} else {
$actionsByFilter[$prefix . $row->afa_filter][$row->afa_consequence] = [
'action' => $row->afa_consequence,
'parameters' => explode( "\n", $row->afa_parameters )
'parameters' => array_filter( explode( "\n", $row->afa_parameters ) )
];
}
}

View file

@ -1093,7 +1093,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
foreach ( $res as $actionRow ) {
$thisAction = [];
$thisAction['action'] = $actionRow->afa_consequence;
$thisAction['parameters'] = explode( "\n", $actionRow->afa_parameters );
$thisAction['parameters'] = array_filter( explode( "\n", $actionRow->afa_parameters ) );
$actions[$actionRow->afa_consequence] = $thisAction;
}
@ -1207,7 +1207,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
$parameters[1] = $request->getVal( 'wpBlockAnonDuration' );
$parameters[2] = $request->getVal( 'wpBlockUserDuration' );
} elseif ( $action == 'tag' ) {
$parameters = explode( "\n", $request->getText( 'wpFilterTags' ) );
$parameters = explode( "\n", trim( $request->getText( 'wpFilterTags' ) ) );
}
$thisAction = [ 'action' => $action, 'parameters' => $parameters ];