Merge "RCFilters: Add an opt-out preference for filters on watchlist"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 5 Jun 2018 01:39:49 +0000 (01:39 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 5 Jun 2018 01:39:50 +0000 (01:39 +0000)
includes/DefaultSettings.php
includes/preferences/DefaultPreferencesFactory.php
includes/specials/SpecialWatchlist.php
languages/i18n/en.json
languages/i18n/qqq.json

index 949e50a..f8a4e81 100644 (file)
@@ -4879,6 +4879,7 @@ $wgDefaultUserOptions = [
        'watchlistunwatchlinks' => 0,
        'watchmoves' => 0,
        'watchrollback' => 0,
+       'wlenhancedfilters-disable' => 0,
        'wllimit' => 250,
        'useeditwarning' => 1,
        'prefershttps' => 1,
@@ -6873,6 +6874,15 @@ $wgUseRCPatrol = true;
  */
 $wgStructuredChangeFiltersShowPreference = false;
 
+/**
+ * Whether a preference is displayed for structured change filters on watchlist.
+ * Works just like $wgStructuredChangeFiltersShowPreference.
+ *
+ * Temporary variable during development and will be removed
+ * @since 1.32
+ */
+$wgStructuredChangeFiltersShowWatchlistPreference = false;
+
 /**
  * Whether to enable RCFilters app on Special:Watchlist
  *
index 2b497f6..eed4b0d 100644 (file)
@@ -1273,6 +1273,15 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                                'help-message' => 'prefs-help-watchlist-token2',
                        ];
                }
+
+               if ( $this->config->get( 'StructuredChangeFiltersShowWatchlistPreference' ) ) {
+                       $defaultPreferences['wlenhancedfilters-disable'] = [
+                               'type' => 'toggle',
+                               'section' => 'watchlist/opt-out',
+                               'label-message' => 'rcfilters-watchlist-preference-label',
+                               'help-message' => 'rcfilters-watchlist-preference-help',
+                       ];
+               }
        }
 
        /**
index ea73347..ce7fea9 100644 (file)
@@ -110,10 +110,15 @@ class SpecialWatchlist extends ChangesListSpecialPage {
        }
 
        public static function checkStructuredFilterUiEnabled( Config $config, User $user ) {
-               return (
-                       $config->get( 'StructuredChangeFiltersOnWatchlist' ) &&
-                       $user->getOption( 'rcenhancedfilters' )
-               );
+               if ( !$config->get( 'StructuredChangeFiltersOnWatchlist' ) ) {
+                       return false;
+               }
+
+               if ( $config->get( 'StructuredChangeFiltersShowWatchlistPreference' ) ) {
+                       return !$user->getOption( 'wlenhancedfilters-disable' );
+               } else {
+                       return $user->getOption( 'rcenhancedfilters' );
+               }
        }
 
        /**
index 8add41f..744dc97 100644 (file)
        "rcfilters-watchlist-showupdated": "Changes to pages you haven't visited since the changes occurred are in <strong>bold</strong>, with solid markers.",
        "rcfilters-preference-label": "Hide the improved version of Recent Changes",
        "rcfilters-preference-help": "Rolls back the 2017 interface redesign and all tools added then and since.",
+       "rcfilters-watchlist-preference-label": "Hide the improved version of the Watchlist",
+       "rcfilters-watchlist-preference-help": "Rolls back the 2017 interface redesign and all tools added then and since.",
        "rcfilters-filter-showlinkedfrom-label": "Show changes on pages linked from",
        "rcfilters-filter-showlinkedfrom-option-label": "<strong>Pages linked from</strong> the selected page",
        "rcfilters-filter-showlinkedto-label": "Show changes on pages linking to",
index 8f5f01f..8c61a14 100644 (file)
        "rcfilters-watchlist-showupdated": "Message at the top of [[Special:Watchlist]] when the Structured filters are enabled that describes what unseen changes look like.\n\nCf. {{msg-mw|wlheader-showupdated}}",
        "rcfilters-preference-label": "Option in RecentChanges tab of [[Special:Preferences]].",
        "rcfilters-preference-help": "Explanation for the option in the RecentChanges tab of [[Special:Preferences]].",
+       "rcfilters-watchlist-preference-label": "Option in Watchlist tab of [[Special:Preferences]].",
+       "rcfilters-watchlist-preference-help": "Explanation for the option in the Watchlist tab of [[Special:Preferences]].",
        "rcfilters-filter-showlinkedfrom-label": "Label that indicates that the page is showing changes that link FROM the target page. Used on [[Special:Recentchangeslinked]] when structured filters are enabled.",
        "rcfilters-filter-showlinkedfrom-option-label": "Menu option to show changes FROM the target page. Used on [[Special:Recentchangeslinked]] when structured filters are enabled.",
        "rcfilters-filter-showlinkedto-label": "Label that indicates that the page is showing changes that link TO the target page. Used on [[Special:Recentchangeslinked]] when structured filters are enabled.",