Merge "RCFilters: Make 'lastRevision' filter include non-rev types"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 22 Sep 2017 17:52:13 +0000 (17:52 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 22 Sep 2017 17:52:13 +0000 (17:52 +0000)
1  2 
includes/specialpage/ChangesListSpecialPage.php

@@@ -84,6 -84,9 +84,9 @@@ abstract class ChangesListSpecialPage e
        public function __construct( $name, $restriction ) {
                parent::__construct( $name, $restriction );
  
+               $nonRevisionTypes = [ RC_LOG ];
+               Hooks::run( 'SpecialWatchlistGetNonRevisionTypes', [ &$nonRevisionTypes ] );
                $this->filterGroupDefinitions = [
                        [
                                'name' => 'registration',
                                                'description' => 'rcfilters-filter-lastrevision-description',
                                                'default' => false,
                                                'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds,
-                                                       &$query_options, &$join_conds ) {
-                                                       $conds[] = 'rc_this_oldid <> page_latest';
+                                                       &$query_options, &$join_conds ) use ( $nonRevisionTypes ) {
+                                                       $conds[] = $dbr->makeList(
+                                                               [
+                                                                       'rc_this_oldid <> page_latest',
+                                                                       'rc_type' => $nonRevisionTypes,
+                                                               ],
+                                                               LIST_OR
+                                                       );
                                                },
                                                'cssClassSuffix' => 'last',
                                                'isRowApplicableCallable' => function ( $ctx, $rc ) {
                                                'description' => 'rcfilters-filter-previousrevision-description',
                                                'default' => false,
                                                'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds,
-                                                       &$query_options, &$join_conds ) {
-                                                       $conds[] = 'rc_this_oldid = page_latest';
+                                                       &$query_options, &$join_conds ) use ( $nonRevisionTypes ) {
+                                                       $conds[] = $dbr->makeList(
+                                                               [
+                                                                       'rc_this_oldid = page_latest',
+                                                                       'rc_type' => $nonRevisionTypes,
+                                                               ],
+                                                               LIST_OR
+                                                       );
                                                },
                                                'cssClassSuffix' => 'previous',
                                                'isRowApplicableCallable' => function ( $ctx, $rc ) {
                                )
                        );
  
 -                      $experimentalStructuredChangeFilters =
 -                              $this->getConfig()->get( 'StructuredChangeFiltersEnableExperimentalViews' );
 -
                        $out->addJsConfigVars( 'wgStructuredChangeFilters', $jsData['groups'] );
 -                      $out->addJsConfigVars(
 -                              'wgStructuredChangeFiltersEnableExperimentalViews',
 -                              $experimentalStructuredChangeFilters
 -                      );
  
                        $out->addJsConfigVars(
                                'wgRCFiltersChangeTags',
                                ]
                        );
  
 +                      $out->addJsConfigVars(
 +                              'StructuredChangeFiltersLiveUpdatePollingRate',
 +                              $this->getConfig()->get( 'StructuredChangeFiltersLiveUpdatePollingRate' )
 +                      );
 +
                        if ( static::$savedQueriesPreferenceName ) {
                                $savedQueries = FormatJson::decode(
                                        $this->getUser()->getOption( static::$savedQueriesPreferenceName )