mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-27 15:30:42 +00:00
When testing against a page creation in RC, set page_id to 0 as in the real filtering
Bug: T334617 Change-Id: Id4465cb36131b745d386168e7e158b6bb4d6418c
This commit is contained in:
parent
e89e094ffa
commit
9369d08773
|
@ -83,7 +83,7 @@ class RCVariableGenerator extends VariableGenerator {
|
|||
return null;
|
||||
}
|
||||
} elseif ( $this->rc->getAttribute( 'rc_this_oldid' ) ) {
|
||||
// It's an edit.
|
||||
// It's an edit (or a page creation).
|
||||
$this->addEditVarsForRow();
|
||||
} elseif (
|
||||
!$this->hookRunner->onAbuseFilterGenerateVarsForRecentChange(
|
||||
|
|
|
@ -129,7 +129,11 @@ class VariableGenerator {
|
|||
string $prefix,
|
||||
RecentChange $rc = null
|
||||
): self {
|
||||
$this->vars->setVar( $prefix . '_id', $title->getArticleID() );
|
||||
if ( $rc && $rc->getAttribute( 'rc_type' ) == RC_NEW ) {
|
||||
$this->vars->setVar( $prefix . '_id', 0 );
|
||||
} else {
|
||||
$this->vars->setVar( $prefix . '_id', $title->getArticleID() );
|
||||
}
|
||||
$this->vars->setVar( $prefix . '_namespace', $title->getNamespace() );
|
||||
$this->vars->setVar( $prefix . '_title', $title->getText() );
|
||||
$this->vars->setVar( $prefix . '_prefixedtitle', $title->getPrefixedText() );
|
||||
|
|
|
@ -64,6 +64,7 @@ class RCVariableGeneratorTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
switch ( $type ) {
|
||||
case 'create':
|
||||
$expectedValues['page_id'] = 0;
|
||||
$expectedValues['old_wikitext'] = '';
|
||||
$expectedValues['old_content_model'] = '';
|
||||
// Fallthrough
|
||||
|
|
Loading…
Reference in a new issue