Tag deletion logs performed with Nuke

Bug: T366068
Change-Id: I3455fab45698884d0b32f0065aaaf9fe7c0c6916
This commit is contained in:
Kgraessle 2024-10-16 10:40:38 -05:00
parent 46c6b8b088
commit e42a881976
5 changed files with 18 additions and 4 deletions

View file

@ -25,7 +25,9 @@
}
},
"Hooks": {
"ContributionsToolLinks": "main"
"ContributionsToolLinks": "main",
"ListDefinedTags": "MediaWiki\\Extension\\Nuke\\Hooks::onRegisterTags",
"ChangeTagsListActive": "MediaWiki\\Extension\\Nuke\\Hooks::onRegisterTags"
},
"ResourceModules": {
"ext.nuke.confirm": {

View file

@ -31,4 +31,14 @@ class Hooks implements ContributionsToolLinksHook {
);
}
}
/**
* Registers Nuke tag for deletion logs
*
* @param string[] &$tags
*/
public static function onRegisterTags( array &$tags ): bool {
$tags[] = 'Nuke';
return true;
}
}

View file

@ -533,7 +533,7 @@ class SpecialNuke extends SpecialPage {
'userId' => $user->getId(),
'wikiPageId' => $title->getId(),
'suppress' => false,
'tags' => '[]',
'tags' => '["Nuke"]',
'logsubtype' => 'delete',
] );
$jobs[] = $job;

View file

@ -97,7 +97,8 @@ class HooksTest extends MediaWikiIntegrationTestCase {
$services->getCommentFormatter(),
$services->getUserFactory(),
$services->getUserIdentityLookup(),
$services->getDatabaseBlockStore()
$services->getDatabaseBlockStore(),
$services->getTempUserConfig()
);
}

View file

@ -465,11 +465,12 @@ class SpecialNukeTest extends SpecialPageTestBase {
$this->assertStringContainsString( '(nuke-deletion-queued: Page123)', $html );
$this->assertStringContainsString( '(nuke-deletion-queued: Paging456)', $html );
$this->assertStringNotContainsString( 'Nuke', $this->getDeleteLogHtml() );
// Ensure all jobs are run
$this->runJobs();
$this->assertStringContainsString( 'Vandalism', $this->getDeleteLogHtml() );
$this->assertStringContainsString( 'Nuke', $this->getDeleteLogHtml() );
$this->assertStringContainsString( $fauxReason, $this->getDeleteLogHtml() );
}