Merge "Use a different message prefix for parser warnings"

This commit is contained in:
jenkins-bot 2021-02-06 19:19:19 +00:00 committed by Gerrit Code Review
commit d7204eaf73
5 changed files with 7 additions and 7 deletions

View file

@ -466,7 +466,7 @@
"abusefilter-exception-invalidiprange": "Invalid IP range \"$2\" provided at character $1.",
"abusefilter-exception-disabledvar": "Variable $2 at character $1 is no longer in use.",
"abusefilter-exception-variablevariable": "set and set_var expect the first argument to be a string literal, found at character $1.",
"abusefilter-warning-match-empty-regex": "This regular expression matches the empty string, at character $1",
"abusefilter-parser-warning-match-empty-regex": "This regular expression matches the empty string, at character $1",
"abusefilter-action-tag": "Tag",
"abusefilter-action-throttle": "Throttle",
"abusefilter-action-warn": "Warn",

View file

@ -506,7 +506,7 @@
"abusefilter-exception-invalidiprange": "Error message from the abuse filter parser. Parameters:\n* $1 - Position in the string\n* $2 - String provided as an argument to a function",
"abusefilter-exception-disabledvar": "Error message from the abuse filter parser. Parameters:\n* $1 - Position in the string\n* $2 - Name of the disabled variable",
"abusefilter-exception-variablevariable": "{{doc-important|Do not translate \"'''set'''\" and \"'''set_var'''\".}} Error message from the abuse filter parser. Parameters:\n* $1 - Position in the string",
"abusefilter-warning-match-empty-regex": "Warning message from the abuse filter parser. Parameters:\n* $1 - Position in the string",
"abusefilter-parser-warning-match-empty-regex": "Warning message from the abuse filter parser. Parameters:\n* $1 - Position in the string",
"abusefilter-action-tag": "{{doc-abusefilter-action}}\n\nThe edit or change can be 'tagged' with a particular tag, which will be shown on Recent Changes, contributions, logs, new pages, history, and everywhere else. \n\nThis is a verb in the imperative form.\n\n{{Identical|Tag}}",
"abusefilter-action-throttle": "{{doc-abusefilter-action}}",
"abusefilter-action-warn": "{{doc-abusefilter-action}}",

View file

@ -13,9 +13,9 @@ class UserVisibleWarning extends AFPUserVisibleException {
*/
public function getMessageObj() : Message {
// Give grep a chance to find the usages:
// abusefilter-warning-match-empty-regex
// abusefilter-parser-warning-match-empty-regex
return new Message(
'abusefilter-warning-' . $this->mExceptionID,
'abusefilter-parser-warning-' . $this->mExceptionID,
array_merge( [ $this->mPosition ], $this->mParams )
);
}

View file

@ -81,14 +81,14 @@ class CheckSyntaxTest extends ApiTestCase {
'warnings' => [
[
'message' => wfMessage(
'abusefilter-warning-exception-1',
'abusefilter-parser-warning-exception-1',
3
)->text(),
'character' => 3,
],
[
'message' => wfMessage(
'abusefilter-warning-exception-2',
'abusefilter-parser-warning-exception-2',
8,
'param'
)->text(),

View file

@ -22,7 +22,7 @@ class UserVisibleWarningTest extends MediaWikiUnitTestCase {
$position = 42;
$params = [ 'foo' ];
$message = ( new UserVisibleWarning( $excID, $position, $params ) )->getMessageObj();
$this->assertSame( 'abusefilter-warning-' . $excID, $message->getKey(), 'msg key' );
$this->assertSame( 'abusefilter-parser-warning-' . $excID, $message->getKey(), 'msg key' );
$this->assertArrayEquals( array_merge( [ $position ], $params ), $message->getParams(), 'msg params' );
}
}