[MediaWiki-commits] [Gerrit] Add triggered filter id as parameter to messages - change (mediawiki...AbuseFilter)
Se4598 has uploaded a new change for review. https://gerrit.wikimedia.org/r/71291 Change subject: Add triggered filter id as parameter to messages .. Add triggered filter id as parameter to messages Bug: 50464 Change-Id: I82f1c7f021c8d95fe50fd4da4bc57a885084 --- M AbuseFilter.class.php M AbuseFilter.i18n.php 2 files changed, 36 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter refs/changes/91/71291/1 diff --git a/AbuseFilter.class.php b/AbuseFilter.class.php index 46a41a0..cd8ebbd 100644 --- a/AbuseFilter.class.php +++ b/AbuseFilter.class.php @@ -757,7 +757,7 @@ } else { $msg = 'abusefilter-warning'; } - $messages[] = array( $msg, $parsed_public_comments, $filter ); + $messages[] = array( $msg, $parsed_public_comments, self::$filters[$filter]->af_id ); $actionsTaken[$filter][] = 'warn'; @@ -780,7 +780,8 @@ foreach ( $actions as $action => $info ) { $newMsg = self::takeConsequenceAction( $action, $info['parameters'], $title, $vars, - self::$filters[$filter]->af_public_comments + self::$filters[$filter]->af_public_comments, + self::$filters[$filter]->af_id ); if ( $newMsg !== null ) { @@ -1166,6 +1167,7 @@ * @param $title Title * @param $vars AbuseFilterVariableHolder * @param $rule_desc +* @param $rule_number * * @return array|null a message describing the action that was taken, * or null if no action was taken. The message is given as an array @@ -1177,7 +1179,7 @@ *not accept Message objects to be added directly. */ public static function takeConsequenceAction( $action, $parameters, $title, - $vars, $rule_desc ) + $vars, $rule_desc, $rule_number ) { global $wgAbuseFilterCustomActionsHandlers, $wgRequest; @@ -1186,12 +1188,13 @@ switch ( $action ) { case 'disallow': if ( strlen( $parameters[0] ) ) { - $message = array( $parameters[0], $rule_desc ); + $message = array( $parameters[0], $rule_desc, $rule_number ); } else { // Generic message. $message = array( 'abusefilter-disallowed', - $rule_desc + $rule_desc, + $rule_number ); } break; @@ -1206,7 +1209,8 @@ $block->setBlocker( $filterUser ); $block->mReason = wfMessage( 'abusefilter-blockreason', - $rule_desc + $rule_desc, + $rule_number )->inContentLanguage()->text(); $block->isHardblock( false ); $block->isAutoblocking( true ); @@ -1236,13 +1240,14 @@ $log = new LogPage( 'block' ); $log->addEntry( 'block', Title::makeTitle( NS_USER, $wgUser->getName() ), - wfMessage( 'abusefilter-blockreason', $rule_desc )->inContentLanguage()->text(), + wfMessage( 'abusefilter-blockreason', $rule_desc, $rule_number )->inContentLanguage()->text(), $logParams, self::getFilterUser() ); $message = array( 'abusefilter-blocked-display', - $rule_desc + $rule_desc, + $rule_number ); break; case 'rangeblock': @@ -1256,7 +1261,8 @@ $block->setBlocker( $filterUser )
[MediaWiki-commits] [Gerrit] Add triggered filter id as parameter to messages - change (mediawiki...AbuseFilter)
Hoo man has submitted this change and it was merged. Change subject: Add triggered filter id as parameter to messages .. Add triggered filter id as parameter to messages Bug: 50464 Change-Id: I82f1c7f021c8d95fe50fd4da4bc57a885084 --- M AbuseFilter.class.php M AbuseFilter.i18n.php 2 files changed, 38 insertions(+), 24 deletions(-) Approvals: Hoo man: Verified; Looks good to me, approved jenkins-bot: Checked Objections: Siebrand: There's a problem with this change, please improve diff --git a/AbuseFilter.class.php b/AbuseFilter.class.php index b067ed5..77deaa4 100644 --- a/AbuseFilter.class.php +++ b/AbuseFilter.class.php @@ -787,7 +787,8 @@ foreach ( $actions as $action => $info ) { $newMsg = self::takeConsequenceAction( $action, $info['parameters'], $title, $vars, - self::$filters[$filter]->af_public_comments + self::$filters[$filter]->af_public_comments, + $filter ); if ( $newMsg !== null ) { @@ -1196,6 +1197,7 @@ * @param $title Title * @param $vars AbuseFilterVariableHolder * @param $rule_desc +* @param $rule_number int|string * * @return array|null a message describing the action that was taken, * or null if no action was taken. The message is given as an array @@ -1207,7 +1209,7 @@ *not accept Message objects to be added directly. */ public static function takeConsequenceAction( $action, $parameters, $title, - $vars, $rule_desc ) + $vars, $rule_desc, $rule_number ) { global $wgAbuseFilterCustomActionsHandlers, $wgRequest; @@ -1216,12 +1218,13 @@ switch ( $action ) { case 'disallow': if ( strlen( $parameters[0] ) ) { - $message = array( $parameters[0], $rule_desc ); + $message = array( $parameters[0], $rule_desc, $rule_number ); } else { // Generic message. $message = array( 'abusefilter-disallowed', - $rule_desc + $rule_desc, + $rule_number ); } break; @@ -1236,7 +1239,8 @@ $block->setBlocker( $filterUser ); $block->mReason = wfMessage( 'abusefilter-blockreason', - $rule_desc + $rule_desc, + $rule_number )->inContentLanguage()->text(); $block->isHardblock( false ); $block->isAutoblocking( true ); @@ -1266,13 +1270,14 @@ $log = new LogPage( 'block' ); $log->addEntry( 'block', Title::makeTitle( NS_USER, $wgUser->getName() ), - wfMessage( 'abusefilter-blockreason', $rule_desc )->inContentLanguage()->text(), + wfMessage( 'abusefilter-blockreason', $rule_desc, $rule_number )->inContentLanguage()->text(), $logParams, self::getFilterUser() ); $message = array( 'abusefilter-blocked-display', - $rule_desc + $rule_desc, + $rule_number ); break; case 'rangeblock': @@ -1286,7 +1291,8 @@ $block->setBlocker( $filterUser ); $block->mReason = wfMessage( 'abusefilter-blockreason', - $rule_desc + $rule_desc, + $rule_number )->inContentLanguage()->text(); $block->isHardblock( false ); $block->prevents( 'createaccount', true );