mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 15:36:58 +00:00
Merge "Allow to avoid pinging from summaries by prefixing with :"
This commit is contained in:
commit
8a3bad099b
|
@ -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()
|
||||
|
|
|
@ -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]]', [] ],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue