Special:RC filter: hidehumans
authorStephane Bisson <sbisson@wikimedia.org>
Mon, 14 Nov 2016 18:51:48 +0000 (13:51 -0500)
committerRoan Kattouw <roan.kattouw@gmail.com>
Wed, 7 Dec 2016 01:55:26 +0000 (17:55 -0800)
Allows showing only bot edits

Will be used by the ERI project.

Bug: T149862
Change-Id: I748eb3c614abd7b8b228efe3da5e9cb569a8618f

includes/specialpage/ChangesListSpecialPage.php
tests/phpunit/includes/specials/SpecialRecentchangesTest.php

index c1c1685..5add448 100644 (file)
@@ -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;
                }
index 388e2fd..0cd1b34 100644 (file)
@@ -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"
+               );
+       }
 }