PageUpdater: apply tags even if RC suppressed.
Sometimes we apply tag to a revision even if we suppress the RecentChange, for example when leaving redirects after page moves. Bug: T291967 Change-Id: I7330d3b56cd2280dd23ec0ccb4e1c4807c534739
This commit is contained in:
parent
6a2f059dda
commit
3a1d030efb
2 changed files with 33 additions and 0 deletions
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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() ) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue