RC Filters: Single boolean filters are not contradictory
authorStephane Bisson <sbisson@wikimedia.org>
Mon, 8 May 2017 12:58:05 +0000 (08:58 -0400)
committerStephane Bisson <sbisson@wikimedia.org>
Mon, 8 May 2017 13:02:49 +0000 (09:02 -0400)
When all boolean filters of a group are selected
(for example: hideanons && hideliu), we consider the selection
unproductive and set them all to false.

Some legacy filters are alone in their group
(for example: ORES hideDamaging). They should not
be considered.

Bug: T164625
Change-Id: Ibb6721ccdfb226b3baac7775c30af230c68309e7

includes/specialpage/ChangesListSpecialPage.php

index 7e70df2..b1a2d16 100644 (file)
@@ -973,13 +973,17 @@ abstract class ChangesListSpecialPage extends SpecialPage {
         * @return bool True if any option was reset
         */
        private function fixContradictoryOptions( FormOptions $opts ) {
-               $contradictorySets = [];
-
                $fixed = $this->fixBackwardsCompatibilityOptions( $opts );
 
                foreach ( $this->filterGroups as $filterGroup ) {
                        if ( $filterGroup instanceof ChangesListBooleanFilterGroup ) {
                                $filters = $filterGroup->getFilters();
+
+                               if ( count( $filters ) === 1 ) {
+                                       // legacy boolean filters should not be considered
+                                       continue;
+                               }
+
                                $allInGroupEnabled = array_reduce(
                                        $filters,
                                        function ( $carry, $filter ) use ( $opts ) {
@@ -990,7 +994,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
 
                                if ( $allInGroupEnabled ) {
                                        foreach ( $filters as $filter ) {
-                                               $opts->reset( $filter->getName() );
+                                               $opts[ $filter->getName() ] = false;
                                        }
 
                                        $fixed = true;