Merge "RC Filters: Disable defaults for legacy filters in structured UI"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 12 Apr 2017 21:48:10 +0000 (21:48 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 12 Apr 2017 21:48:10 +0000 (21:48 +0000)
1  2 
includes/specialpage/ChangesListSpecialPage.php

@@@ -379,7 -379,7 +379,7 @@@ abstract class ChangesListSpecialPage e
                                                },
                                                'cssClassSuffix' => 'patrolled',
                                                'isRowApplicableCallable' => function ( $ctx, $rc ) {
 -                                                                                   return $rc->getAttribute( 'rc_patrolled' );
 +                                                      return $rc->getAttribute( 'rc_patrolled' );
                                                },
                                        ],
                                        [
                                                },
                                                'cssClassSuffix' => 'unpatrolled',
                                                'isRowApplicableCallable' => function ( $ctx, $rc ) {
 -                                                                                   return !$rc->getAttribute( 'rc_patrolled' );
 +                                                      return !$rc->getAttribute( 'rc_patrolled' );
                                                },
                                        ],
                                ],
        public function getDefaultOptions() {
                $config = $this->getConfig();
                $opts = new FormOptions();
+               $structuredUI = $this->getUser()->getOption( 'rcenhancedfilters' );
  
                // Add all filters
                foreach ( $this->filterGroups as $filterGroup ) {
                                $opts->add( $filterGroup->getName(), $filterGroup->getDefault() );
                        } else {
                                foreach ( $filterGroup->getFilters() as $filter ) {
-                                       $opts->add( $filter->getName(), $filter->getDefault() );
+                                       $opts->add( $filter->getName(), $filter->getDefault( $structuredUI ) );
                                }
                        }
                }
                &$tables, &$fields, &$conds, &$query_options, &$join_conds, $selectedExpLevels ) {
  
                global $wgLearnerEdits,
 -                         $wgExperiencedUserEdits,
 -                         $wgLearnerMemberSince,
 -                         $wgExperiencedUserMemberSince;
 +                      $wgExperiencedUserEdits,
 +                      $wgLearnerMemberSince,
 +                      $wgExperiencedUserMemberSince;
  
                $LEVEL_COUNT = 3;
  
                );
  
                if ( $selectedExpLevels === [ 'newcomer' ] ) {
 -                      $conds[] =  "NOT ( $aboveNewcomer )";
 +                      $conds[] = "NOT ( $aboveNewcomer )";
                } elseif ( $selectedExpLevels === [ 'learner' ] ) {
                        $conds[] = $dbr->makeList(
                                [ $aboveNewcomer, "NOT ( $aboveLearner )" ],