From: Roan Kattouw Date: Thu, 31 May 2018 02:25:17 +0000 (-0700) Subject: RCFilters: Add an opt-out preference for filters on watchlist X-Git-Tag: 1.34.0-rc.0~5193^2 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=5b2dd85524a0a79d51d5e42e05c45b0ac105e389;p=lhc%2Fweb%2Fwiklou.git RCFilters: Add an opt-out preference for filters on watchlist And a temporary feature flag so we can roll it out in stages. Bug: T195431 Change-Id: I170840146a197ac381df94434350ae2f0561d147 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 87ca0168bd..3362502977 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4905,6 +4905,7 @@ $wgDefaultUserOptions = [ 'watchlistunwatchlinks' => 0, 'watchmoves' => 0, 'watchrollback' => 0, + 'wlenhancedfilters-disable' => 0, 'wllimit' => 250, 'useeditwarning' => 1, 'prefershttps' => 1, @@ -6890,6 +6891,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 * diff --git a/includes/preferences/DefaultPreferencesFactory.php b/includes/preferences/DefaultPreferencesFactory.php index 2d7d73fac3..87e2693072 100644 --- a/includes/preferences/DefaultPreferencesFactory.php +++ b/includes/preferences/DefaultPreferencesFactory.php @@ -1275,6 +1275,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', + ]; + } } /** diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index dda1dac3af..1862133aa5 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -111,10 +111,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' ); + } } /** diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 215b356eab..eec7ad1d58 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1505,6 +1505,8 @@ "rcfilters-watchlist-showupdated": "Changes to pages you haven't visited since the changes occurred are in bold, 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": "Pages linked from the selected page", "rcfilters-filter-showlinkedto-label": "Show changes on pages linking to", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 97ac8079ac..56f01fee74 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1703,6 +1703,8 @@ "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.",