RCFilters: Show "from" link when live update is not available
authorStephane Bisson <sbisson@wikimedia.org>
Fri, 4 Aug 2017 11:41:15 +0000 (07:41 -0400)
committerStephane Bisson <sbisson@wikimedia.org>
Fri, 4 Aug 2017 11:41:15 +0000 (07:41 -0400)
Also introduce a place for feature flags.

Change-Id: Id118b85c727a865745283ee8fabda7050f317ce1

resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js
resources/src/mediawiki.rcfilters/mw.rcfilters.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterWrapperWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FormWrapperWidget.js

index 9867220..f0e3bd0 100644 (file)
         * @private
         */
        mw.rcfilters.Controller.prototype._shouldCheckForNewChanges = function () {
-               var liveUpdateFeatureFlag = mw.config.get( 'wgStructuredChangeFiltersEnableLiveUpdate' ) ||
-                       new mw.Uri().query.liveupdate;
-
                return !document.hidden &&
                        !this.filtersModel.hasConflict() &&
                        !this.changesListModel.getNewChangesExist() &&
                        !this.updatingChangesList &&
-                       liveUpdateFeatureFlag;
+                       mw.rcfilters.featureFlags.liveUpdate;
        };
 
        /**
index c62d6f2..7bdc2a2 100644 (file)
@@ -44,6 +44,9 @@
 
                                return result;
                        }
+               },
+               featureFlags: {
+                       liveUpdate: mw.config.get( 'wgStructuredChangeFiltersEnableLiveUpdate' ) || new mw.Uri().query.liveupdate
                }
        };
 }( mediaWiki ) );
index 44d4459..8f8ca38 100644 (file)
                                .append( this.savedLinksListWidget.$element )
                );
 
-               if (
-                       mw.config.get( 'wgStructuredChangeFiltersEnableLiveUpdate' ) ||
-                       // Allow users to enable live update with ?liveupdate=1
-                       new mw.Uri().query.liveupdate
-               ) {
+               if ( mw.rcfilters.featureFlags.liveUpdate ) {
                        $bottom.append( this.liveUpdateButton.$element );
                }
 
index 7f7bbd2..82992fb 100644 (file)
                        this.$element.find( 'br' ).detach();
                }
 
-               this.$element.find(
-                       'legend, .rclistfrom, .rcnotefrom, .rcoptions-listfromreset'
-               ).detach();
+               if ( mw.rcfilters.featureFlags.liveUpdate ) {
+                       this.$element.find(
+                               'legend, .rclistfrom, .rcnotefrom, .rcoptions-listfromreset'
+                       ).detach();
+               }
 
                if ( this.$element.text().trim() === '' ) {
                        this.$element.detach();