Merge "Allow to avoid pinging from summaries by prefixing with :"

This commit is contained in:
jenkins-bot 2018-03-08 19:14:35 +00:00 committed by Gerrit Code Review
commit 8a3bad099b
2 changed files with 11 additions and 0 deletions

View file

@ -33,6 +33,9 @@ class EchoSummaryParser {
$regex = '/\[\[([' . Title::legalChars() . ']*+)(?:\|.*?)?\]\]/';
if ( preg_match_all( $regex, $summary, $matches ) ) {
foreach ( $matches[1] as $match ) {
if ( preg_match( '/^:/', $match ) ) {
continue;
}
$title = Title::newFromText( $match );
if ( $title
&& $title->isLocal()

View file

@ -43,6 +43,11 @@ class EchoSummaryParserTest extends MediaWikiTestCase {
[ 'Werdna', [] ],
[ 'User:Werdna', [] ],
[ '[User:Werdna]', [] ],
[ '[[]]', [] ],
[ '[[:]]', [] ],
[ '[[|]]', [] ],
[ '[[:|]]', [] ],
[ '[[:|test]]', [] ],
[ '[[User:Nonexistent]]', [] ],
[ '/* [[User:Werdna */', [] ],
[ '[[User:Werdna]]', [ 'Werdna' ] ],
@ -54,6 +59,9 @@ class EchoSummaryParserTest extends MediaWikiTestCase {
[ '/**/[[User:Werdna]][[user:jorm]]', [ 'Werdna', 'Jorm' ] ],
[ '/* [[User:Werdna]] */ [[ user : jim_ Carter_]]', [ 'Jim Carter' ] ],
[ '[[User:/* Jorm */]][[User:/* remove me */Werdna]]', [] ],
[ '[[:User:Werdna]]', [] ],
[ '[[:User:Werdna|]]', [] ],
[ '[[:User:Werdna|foo]]', [] ],
];
}
}