Merge "Avoid duplicate IDs on Special:Preferences"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 6 Jul 2018 23:55:51 +0000 (23:55 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 6 Jul 2018 23:55:51 +0000 (23:55 +0000)
includes/preferences/DefaultPreferencesFactory.php
includes/specials/forms/PreferencesFormLegacy.php
includes/specials/forms/PreferencesFormOOUI.php

index 03e4bdb..bcd15b3 100644 (file)
@@ -1080,7 +1080,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                if ( $this->config->get( 'StructuredChangeFiltersShowPreference' ) ) {
                        $defaultPreferences['rcenhancedfilters-disable'] = [
                                'type' => 'toggle',
-                               'section' => 'rc/opt-out',
+                               'section' => 'rc/optoutrc',
                                'label-message' => 'rcfilters-preference-label',
                                'help-message' => 'rcfilters-preference-help',
                        ];
@@ -1283,7 +1283,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                if ( $this->config->get( 'StructuredChangeFiltersShowWatchlistPreference' ) ) {
                        $defaultPreferences['wlenhancedfilters-disable'] = [
                                'type' => 'toggle',
-                               'section' => 'watchlist/opt-out',
+                               'section' => 'watchlist/optoutwatchlist',
                                'label-message' => 'rcfilters-watchlist-preference-label',
                                'help-message' => 'rcfilters-watchlist-preference-help',
                        ];
index cae895f..c1f1026 100644 (file)
@@ -130,7 +130,8 @@ class PreferencesFormLegacy extends HTMLForm {
         * @return string
         */
        function getLegend( $key ) {
-               $legend = parent::getLegend( $key );
+               $aliasKey = ( $key === 'optoutwatchlist' || $key === 'optoutrc' ) ? 'opt-out' : $key;
+               $legend = parent::getLegend( $aliasKey );
                Hooks::run( 'PreferencesGetLegend', [ $this, $key, &$legend ] );
                return $legend;
        }
index 423e2bb..cfa8f8f 100644 (file)
@@ -227,7 +227,8 @@ class PreferencesFormOOUI extends OOUIHTMLForm {
         * @return string
         */
        function getLegend( $key ) {
-               $legend = parent::getLegend( $key );
+               $aliasKey = ( $key === 'optoutwatchlist' || $key === 'optoutrc' ) ? 'opt-out' : $key;
+               $legend = parent::getLegend( $aliasKey );
                Hooks::run( 'PreferencesGetLegend', [ $this, $key, &$legend ] );
                return $legend;
        }