jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/320446 )

Change subject: Special:RC 'hidemajor' filter
......................................................................


Special:RC 'hidemajor' filter

'hidemajor', along with the existing 'hideminor'
RC filter, allow showing just the minor edits,
just the major edits, or both.

This will be used by the ERI project.

Bug: T149863
Change-Id: I936a4a1b13d8c4a15c745012cd0f82207d9e57ca
---
M includes/specialpage/ChangesListSpecialPage.php
M tests/phpunit/includes/specials/SpecialRecentchangesTest.php
2 files changed, 36 insertions(+), 2 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specialpage/ChangesListSpecialPage.php 
b/includes/specialpage/ChangesListSpecialPage.php
index 2051948..00efeae 100644
--- a/includes/specialpage/ChangesListSpecialPage.php
+++ b/includes/specialpage/ChangesListSpecialPage.php
@@ -140,6 +140,7 @@
                $opts = new FormOptions();
 
                $opts->add( 'hideminor', false );
+               $opts->add( 'hidemajor', false );
                $opts->add( 'hidebots', false );
                $opts->add( 'hidehumans', false );
                $opts->add( 'hideanons', false );
@@ -235,7 +236,10 @@
 
                // Toggles
                if ( $opts['hideminor'] ) {
-                       $conds['rc_minor'] = 0;
+                       $conds[] = 'rc_minor = 0';
+               }
+               if ( $opts['hidemajor'] ) {
+                       $conds[] = 'rc_minor = 1';
                }
                if ( $opts['hidebots'] ) {
                        $conds['rc_bot'] = 0;
diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php 
b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
index 03e9c8f..c11e6a3 100644
--- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
+++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
@@ -55,13 +55,15 @@
        }
 
        private static function normalizeCondition( $conds ) {
-               return array_map(
+               $normalized = array_map(
                        function ( $k, $v ) {
                                return is_numeric( $k ) ? $v : "$k = $v";
                        },
                        array_keys( $conds ),
                        $conds
                );
+               sort( $normalized );
+               return $normalized;
        }
 
        /** return false if condition begin with 'rc_timestamp ' */
@@ -343,6 +345,34 @@
                );
        }
 
+       public function testRcHideminorFilter() {
+               $this->assertConditions(
+                       [ # expected
+                               'rc_bot' => 0,
+                               "rc_minor = 0",
+                               "rc_type != '6'",
+                       ],
+                       [
+                               'hideminor' => 1,
+                       ],
+                       "rc conditions: hideminor=1"
+               );
+       }
+
+       public function testRcHidemajorFilter() {
+               $this->assertConditions(
+                       [ # expected
+                               'rc_bot' => 0,
+                               "rc_minor = 1",
+                               "rc_type != '6'",
+                       ],
+                       [
+                               'hidemajor' => 1,
+                       ],
+                       "rc conditions: hidemajor=1"
+               );
+       }
+
        // This is probably going to change when we do auto-fix of
        // filters combinations that don't make sense but for now
        // it's the behavior therefore it's the test.

-- 
To view, visit https://gerrit.wikimedia.org/r/320446
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I936a4a1b13d8c4a15c745012cd0f82207d9e57ca
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Sbisson <sbis...@wikimedia.org>
Gerrit-Reviewer: Catrope <r...@wikimedia.org>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: Sbisson <sbis...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to