Merge "RCFilters: Make live update polling configurable"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 22 Sep 2017 17:38:59 +0000 (17:38 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 22 Sep 2017 17:39:00 +0000 (17:39 +0000)
includes/DefaultSettings.php
includes/specialpage/ChangesListSpecialPage.php
resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js
resources/src/mediawiki.rcfilters/mw.rcfilters.js

index 27f95ad..d462228 100644 (file)
@@ -6819,6 +6819,13 @@ $wgStructuredChangeFiltersShowPreference = false;
  */
 $wgStructuredChangeFiltersOnWatchlist = false;
 
+/**
+ * Polling rate, in seconds, used by the 'live update' and 'view newest' features
+ * of the RCFilters app on SpecialRecentChanges and Special:Watchlist.
+ * 0 to disable completely.
+ */
+$wgStructuredChangeFiltersLiveUpdatePollingRate = 3;
+
 /**
  * Use new page patrolling to check new pages on Special:Newpages
  */
index cf6c8e3..b0a6ed6 100644 (file)
@@ -617,6 +617,11 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                                ]
                        );
 
+                       $out->addJsConfigVars(
+                               'StructuredChangeFiltersLiveUpdatePollingRate',
+                               $this->getConfig()->get( 'StructuredChangeFiltersLiveUpdatePollingRate' )
+                       );
+
                        if ( static::$savedQueriesPreferenceName ) {
                                $savedQueries = FormatJson::decode(
                                        $this->getUser()->getOption( static::$savedQueriesPreferenceName )
index 507c979..ed2a73f 100644 (file)
                this.initializing = false;
                this.switchView( 'default' );
 
-               this._scheduleLiveUpdate();
+               this.pollingRate = mw.config.get( 'StructuredChangeFiltersLiveUpdatePollingRate' );
+               if ( this.pollingRate ) {
+                       this._scheduleLiveUpdate();
+               }
        };
 
        /**
         * @private
         */
        mw.rcfilters.Controller.prototype._scheduleLiveUpdate = function () {
-               setTimeout( this._doLiveUpdate.bind( this ), 3000 );
+               setTimeout( this._doLiveUpdate.bind( this ), this.pollingRate * 1000 );
        };
 
        /**
index d203328..e28f34a 100644 (file)
@@ -46,7 +46,7 @@
                        }
                },
                featureFlags: {
-                       liveUpdate: mw.config.get( 'wgStructuredChangeFiltersLiveUpdateSupported' ) &&
+                       liveUpdate: mw.config.get( 'StructuredChangeFiltersLiveUpdatePollingRate' ) &&
                                ( mw.user.options.get( 'rcenhancedfilters' ) || new mw.Uri().query.liveupdate )
                }
        };