Special:RC filters: hide page edits, new pages, log entries
authorStephane Bisson <sbisson@wikimedia.org>
Mon, 14 Nov 2016 19:17:42 +0000 (14:17 -0500)
committerRoan Kattouw <roan.kattouw@gmail.com>
Wed, 7 Dec 2016 01:54:07 +0000 (17:54 -0800)
New RC filters for ERI project:
  hidepageedits
  hidenewpages
  hidelog

Bug: T150060
Change-Id: I6fe852fb0f5386c3385ada5189ceaf0d9bbc979d

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

index 9e3e3df..c1c1685 100644 (file)
@@ -150,6 +150,9 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                if ( $config->get( 'RCWatchCategoryMembership' ) ) {
                        $opts->add( 'hidecategorization', false );
                }
+               $opts->add( 'hidepageedits', false );
+               $opts->add( 'hidenewpages', false );
+               $opts->add( 'hidelog', false );
 
                $opts->add( 'namespace', '', FormOptions::INTNULL );
                $opts->add( 'invert', false );
@@ -269,6 +272,15 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                ) {
                        $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_CATEGORIZE );
                }
+               if ( $opts['hidepageedits'] ) {
+                       $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_EDIT );
+               }
+               if ( $opts['hidenewpages'] ) {
+                       $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_NEW );
+               }
+               if ( $opts['hidelog'] ) {
+                       $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_LOG );
+               }
 
                // Namespace filtering
                if ( $opts['namespace'] !== '' ) {
index 6fb0d23..388e2fd 100644 (file)
@@ -225,4 +225,46 @@ class SpecialRecentchangesTest extends MediaWikiTestCase {
                        $user
                );
        }
+
+       public function testRcHidepageedits() {
+               $this->assertConditions(
+                       [ # expected
+                               'rc_bot' => 0,
+                               "rc_type != '6'",
+                               "rc_type != '0'",
+                       ],
+                       [
+                               'hidepageedits' => 1,
+                       ],
+                       "rc conditions: hidepageedits=1"
+               );
+       }
+
+       public function testRcHidenewpages() {
+               $this->assertConditions(
+                       [ # expected
+                               'rc_bot' => 0,
+                               "rc_type != '6'",
+                               "rc_type != '1'",
+                       ],
+                       [
+                               'hidenewpages' => 1,
+                       ],
+                       "rc conditions: hidenewpages=1"
+               );
+       }
+
+       public function testRcHidelog() {
+               $this->assertConditions(
+                       [ # expected
+                               'rc_bot' => 0,
+                               "rc_type != '6'",
+                               "rc_type != '3'",
+                       ],
+                       [
+                               'hidelog' => 1,
+                       ],
+                       "rc conditions: hidelog=1"
+               );
+       }
 }