Merge "PageUpdater: apply tags even if RC suppressed."

This commit is contained in:
jenkins-bot 2021-11-05 15:17:40 +00:00 committed by Gerrit Code Review
commit b18537d30d
2 changed files with 33 additions and 0 deletions

View file

@ -25,6 +25,7 @@
namespace MediaWiki\Storage;
use AtomicSectionUpdate;
use ChangeTags;
use CommentStoreComment;
use Content;
use ContentHandler;
@ -1304,6 +1305,8 @@ class PageUpdater {
$tags,
$editResult
);
} else {
ChangeTags::addTags( $tags, null, $newRevisionRecord->getId(), null );
}
$this->userEditTracker->incrementUserEditCount( $this->author );
@ -1423,6 +1426,8 @@ class PageUpdater {
$this->rcPatrolStatus,
$tags
);
} else {
ChangeTags::addTags( $tags, null, $newRevisionRecord->getId(), null );
}
$this->userEditTracker->incrementUserEditCount( $this->author );

View file

@ -2,10 +2,12 @@
namespace MediaWiki\Tests\Storage;
use ChangeTags;
use CommentStoreComment;
use Content;
use DeferredUpdates;
use FormatJson;
use MediaWiki\Page\PageIdentityValue;
use MediaWiki\Revision\RenderedRevision;
use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Revision\SlotRecord;
@ -969,4 +971,30 @@ class PageUpdaterTest extends MediaWikiIntegrationTestCase {
$this->assertStringContainsString( $expected, $html, 'In HTML' );
}
public function testChangeTagsSuppressRecentChange() {
$page = PageIdentityValue::localIdentity( 0, NS_MAIN, __METHOD__ );
$revision = $this->getServiceContainer()
->getPageUpdaterFactory()
->newPageUpdater(
WikiPage::factory( $page ),
$this->getTestUser()->getUser()
)
->setContent( SlotRecord::MAIN, new TextContent( 'Lorem Ipsum' ) )
->addTag( 'foo' )
->setFlags( EDIT_SUPPRESS_RC )
->saveRevision( CommentStoreComment::newUnsavedComment( 'Comment' ) );
$this->assertArrayEquals( [ 'foo' ], ChangeTags::getTags( $this->db, null, $revision->getId() ) );
$revision2 = $this->getServiceContainer()
->getPageUpdaterFactory()
->newPageUpdater(
WikiPage::factory( $page ),
$this->getTestUser()->getUser()
)
->setContent( SlotRecord::MAIN, new TextContent( 'Other content' ) )
->addTag( 'bar' )
->setFlags( EDIT_SUPPRESS_RC )
->saveRevision( CommentStoreComment::newUnsavedComment( 'Comment' ) );
$this->assertArrayEquals( [ 'bar' ], ChangeTags::getTags( $this->db, null, $revision2->getId() ) );
}
}