mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Nuke
synced 2024-11-27 09:40:43 +00:00
SpecialNuke: Display username next to pages for temp accounts
Why: - When deleting pages created by temporary accounts via inputting an IP address, it's useful to see which temporary accounts were involved in creating the pages. This is currently not displayed because $row->rc_user_text is not set What: - Fetch the actor_name field unconditionally - Display the page using the actor_name field - Update tests for the change Bug: T342785 Change-Id: Ic4112985874343ede78c4571bdfccc58977c5345
This commit is contained in:
parent
00729bdd58
commit
f1d53c8244
|
@ -451,13 +451,10 @@ class SpecialNuke extends SpecialPage {
|
|||
->orderBy( 'rc_timestamp', SelectQueryBuilder::SORT_DESC )
|
||||
->limit( $limit );
|
||||
|
||||
if ( $username === '' ) {
|
||||
$queryBuilder->field( 'actor_name', 'rc_user_text' );
|
||||
} else {
|
||||
$actornames = array_filter( [ $username, ...$tempnames ] );
|
||||
if ( $actornames ) {
|
||||
$queryBuilder->andWhere( [ 'actor_name' => $actornames ] );
|
||||
}
|
||||
$queryBuilder->field( 'actor_name', 'rc_user_text' );
|
||||
$actornames = array_filter( [ $username, ...$tempnames ] );
|
||||
if ( $actornames ) {
|
||||
$queryBuilder->andWhere( [ 'actor_name' => $actornames ] );
|
||||
}
|
||||
|
||||
if ( $namespace !== null ) {
|
||||
|
@ -559,7 +556,7 @@ class SpecialNuke extends SpecialPage {
|
|||
foreach ( $result as $row ) {
|
||||
$pages[] = [
|
||||
Title::makeTitle( $row->page_namespace, $row->page_title ),
|
||||
$username === '' ? $row->rc_user_text : false
|
||||
$row->rc_user_text
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -251,8 +251,7 @@ class SpecialNukeTest extends SpecialPageTestBase {
|
|||
$this->assertStringContainsString( 'Target1', $html );
|
||||
$this->assertStringContainsString( 'Target2', $html );
|
||||
|
||||
$usernameCount = substr_count( $html, $ip );
|
||||
$this->assertStringContainsString( 5, $usernameCount );
|
||||
$this->assertEquals( 2, substr_count( $html, '(nuke-editby: 127.0.0.1)' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,8 +284,7 @@ class SpecialNukeTest extends SpecialPageTestBase {
|
|||
$adminPerformer = new UltimateAuthority( $adminUser );
|
||||
[ $html ] = $this->executeSpecialPage( '', $request, 'qqx', $adminPerformer );
|
||||
|
||||
$usernameCount = substr_count( $html, $ip );
|
||||
$this->assertStringContainsString( 1, $usernameCount );
|
||||
$this->assertEquals( 2, substr_count( $html, '(nuke-editby: ~2024-1)' ) );
|
||||
|
||||
$this->assertStringContainsString( '(nuke-list-tempaccount:', $html );
|
||||
$this->assertStringContainsString( 'Target1', $html );
|
||||
|
@ -332,8 +330,8 @@ class SpecialNukeTest extends SpecialPageTestBase {
|
|||
$adminPerformer = new UltimateAuthority( $adminUser );
|
||||
[ $html ] = $this->executeSpecialPage( '', $request, 'qqx', $adminPerformer );
|
||||
|
||||
$usernameCount = substr_count( $html, $ip );
|
||||
$this->assertStringContainsString( 1, $usernameCount );
|
||||
$this->assertSame( 1, substr_count( $html, ' (nuke-editby: ~2024-1)' ) );
|
||||
$this->assertSame( 1, substr_count( $html, ' (nuke-editby: 1.2.3.4)' ) );
|
||||
|
||||
// They should all show up together
|
||||
$this->assertStringContainsString( '(nuke-list-tempaccount:', $html );
|
||||
|
|
Loading…
Reference in a new issue