mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Refactor, pretty up and spread localisation of filter consequences (in logs, history, filter summary, etc)
This commit is contained in:
parent
6a4457d8f5
commit
36b78662b0
|
@ -751,4 +751,10 @@ class AbuseFilter {
|
|||
|
||||
return array( $af_row, $actions_output );
|
||||
}
|
||||
|
||||
static function getActionDisplay( $action ) {
|
||||
$display = wfMsg( "abusefilter-action-$action" );
|
||||
$display = wfEmptyMsg( "abusefilter-action-$action", $display ) ? $action : $display;
|
||||
return $display;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,6 +195,14 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
$actions_taken = $row->afl_actions;
|
||||
if (!strlen(trim($actions_taken))) {
|
||||
$actions_taken = wfMsg( 'abusefilter-log-noactions' );
|
||||
} else {
|
||||
$actions = explode(',', $actions_taken);
|
||||
$displayActions = array();
|
||||
|
||||
foreach( $actions as $action ) {
|
||||
$displayActions[] = AbuseFilter::getActionDisplay( $action );;
|
||||
}
|
||||
$actions_taken = implode( ', ', $displayActions );
|
||||
}
|
||||
|
||||
if ($this->canSeeDetails()) {
|
||||
|
|
|
@ -133,7 +133,7 @@ class AbuseFilterHistoryPager extends TablePager {
|
|||
$display_actions = '';
|
||||
|
||||
foreach( $actions as $action => $parameters ) {
|
||||
$display_actions .= Xml::tags( 'li', null, wfMsgExt( 'abusefilter-history-action', array( 'parseinline' ), array($action, implode('; ', $parameters)) ) );
|
||||
$display_actions .= Xml::tags( 'li', null, wfMsgExt( 'abusefilter-history-action', array( 'parseinline' ), array( AbuseFilter::getActionDisplay($action), implode('; ', $parameters)) ) );
|
||||
}
|
||||
$display_actions = Xml::tags( 'ul', null, $display_actions );
|
||||
|
||||
|
|
|
@ -172,9 +172,7 @@ class AbuseFilterPager extends TablePager {
|
|||
$actions = explode(',', $value);
|
||||
$displayActions = array();
|
||||
foreach( $actions as $action ) {
|
||||
$display = wfMsg( "abusefilter-action-$action" );
|
||||
$display = wfEmptyMsg( "abusefilter-action-$action", $display ) ? $action : $display;
|
||||
$displayActions[] = $display;
|
||||
$displayActions[] = AbuseFilter::getActionDisplay( $action );;
|
||||
}
|
||||
return htmlspecialchars( implode( ', ', $displayActions ) );
|
||||
case 'status':
|
||||
|
|
|
@ -47,9 +47,7 @@ class AbuseFilterViewRevert extends AbuseFilterView {
|
|||
$displayActions = array();
|
||||
|
||||
global $wgLang;
|
||||
foreach( $result['actions'] as $action ) {
|
||||
$displayActions[] = wfMsgExt( "abusefilter-action-$action", 'parseinline' );
|
||||
}
|
||||
$displayActions = array_map( array( 'AbuseFilter', 'getActionDisplay' ), $result['actions'] );
|
||||
|
||||
$msg = wfMsgExt( 'abusefilter-revert-preview-item', array( 'parseinline', 'replaceafter' ),
|
||||
array( $wgLang->timeanddate( $result['timestamp'] ), $sk->userLink( $result['userid'],
|
||||
|
|
Loading…
Reference in a new issue