From b33a9844b0f095464c0892daebc0a444ca439375 Mon Sep 17 00:00:00 2001 From: Stephane Bisson Date: Mon, 14 Nov 2016 13:51:48 -0500 Subject: [PATCH] Special:RC filter: hidehumans Allows showing only bot edits Will be used by the ERI project. Bug: T149862 Change-Id: I748eb3c614abd7b8b228efe3da5e9cb569a8618f --- includes/specialpage/ChangesListSpecialPage.php | 4 ++++ .../includes/specials/SpecialRecentchangesTest.php | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index c1c16854a0..5add448b63 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -141,6 +141,7 @@ abstract class ChangesListSpecialPage extends SpecialPage { $opts->add( 'hideminor', false ); $opts->add( 'hidebots', false ); + $opts->add( 'hidehumans', false ); $opts->add( 'hideanons', false ); $opts->add( 'hideliu', false ); $opts->add( 'hidepatrolled', false ); @@ -238,6 +239,9 @@ abstract class ChangesListSpecialPage extends SpecialPage { if ( $opts['hidebots'] ) { $conds['rc_bot'] = 0; } + if ( $opts['hidehumans'] ) { + $conds[] = 'rc_bot = 1'; + } if ( $user->useRCPatrol() && $opts['hidepatrolled'] ) { $conds['rc_patrolled'] = 0; } diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php index 388e2fd8a5..0cd1b3432c 100644 --- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php +++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php @@ -267,4 +267,18 @@ class SpecialRecentchangesTest extends MediaWikiTestCase { "rc conditions: hidelog=1" ); } + + public function testRcHidehumans() { + $this->assertConditions( + [ # expected + 'rc_bot' => 1, + "rc_type != '6'", + ], + [ + 'hidebots' => 0, + 'hidehumans' => 1, + ], + "rc conditions: hidebots=0 hidehumans=1" + ); + } } -- 2.20.1