Merge "Special:Preferences: Create flag to enable OOjs UI"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 8 May 2018 21:32:01 +0000 (21:32 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 8 May 2018 21:32:01 +0000 (21:32 +0000)
1  2 
autoload.php
includes/DefaultSettings.php
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php

diff --combined autoload.php
@@@ -970,6 -970,14 +970,6 @@@ $wgAutoloadLocalClasses = 
        'MediaWiki\\Storage\\SlotRecord' => __DIR__ . '/includes/Storage/SlotRecord.php',
        'MediaWiki\\Storage\\SqlBlobStore' => __DIR__ . '/includes/Storage/SqlBlobStore.php',
        'MediaWiki\\Storage\\SuppressedDataException' => __DIR__ . '/includes/Storage/SuppressedDataException.php',
 -      'MediaWiki\\Tidy\\BalanceActiveFormattingElements' => __DIR__ . '/includes/tidy/Balancer.php',
 -      'MediaWiki\\Tidy\\BalanceElement' => __DIR__ . '/includes/tidy/Balancer.php',
 -      'MediaWiki\\Tidy\\BalanceMarker' => __DIR__ . '/includes/tidy/Balancer.php',
 -      'MediaWiki\\Tidy\\BalanceSets' => __DIR__ . '/includes/tidy/Balancer.php',
 -      'MediaWiki\\Tidy\\BalanceStack' => __DIR__ . '/includes/tidy/Balancer.php',
 -      'MediaWiki\\Tidy\\Balancer' => __DIR__ . '/includes/tidy/Balancer.php',
 -      'MediaWiki\\Tidy\\Html5Depurate' => __DIR__ . '/includes/tidy/Html5Depurate.php',
 -      'MediaWiki\\Tidy\\Html5Internal' => __DIR__ . '/includes/tidy/Html5Internal.php',
        'MediaWiki\\Tidy\\RaggettBase' => __DIR__ . '/includes/tidy/RaggettBase.php',
        'MediaWiki\\Tidy\\RaggettExternal' => __DIR__ . '/includes/tidy/RaggettExternal.php',
        'MediaWiki\\Tidy\\RaggettInternalHHVM' => __DIR__ . '/includes/tidy/RaggettInternalHHVM.php',
        'PostgresUpdater' => __DIR__ . '/includes/installer/PostgresUpdater.php',
        'Preferences' => __DIR__ . '/includes/Preferences.php',
        'PreferencesForm' => __DIR__ . '/includes/specials/forms/PreferencesForm.php',
+       'PreferencesFormLegacy' => __DIR__ . '/includes/specials/forms/PreferencesFormLegacy.php',
+       'PreferencesFormOOUI' => __DIR__ . '/includes/specials/forms/PreferencesFormOOUI.php',
        'PrefixSearch' => __DIR__ . '/includes/PrefixSearch.php',
        'PreprocessDump' => __DIR__ . '/maintenance/preprocessDump.php',
        'Preprocessor' => __DIR__ . '/includes/parser/Preprocessor.php',
        'SpecialWatchlist' => __DIR__ . '/includes/specials/SpecialWatchlist.php',
        'SpecialWhatLinksHere' => __DIR__ . '/includes/specials/SpecialWhatlinkshere.php',
        'SqlBagOStuff' => __DIR__ . '/includes/objectcache/SqlBagOStuff.php',
 -      'SqlDataUpdate' => __DIR__ . '/includes/deferred/SqlDataUpdate.php',
        'SqlSearchResultSet' => __DIR__ . '/includes/search/SqlSearchResultSet.php',
        'Sqlite' => __DIR__ . '/maintenance/sqlite.inc',
        'SqliteInstaller' => __DIR__ . '/includes/installer/SqliteInstaller.php',
@@@ -1919,8 -1919,8 +1919,8 @@@ $wgSQLiteDataDir = ''
   * $wgSharedSchema is the table schema for the shared database. It defaults to
   * $wgDBmwschema.
   *
 - * @deprecated since 1.21 In new code, use the $wiki parameter to wfGetLB() to
 - *   access remote databases. Using wfGetLB() allows the shared database to
 + * @deprecated since 1.21 In new code, use the $wiki parameter to LBFactory::getMainLB() to
 + *   access remote databases. Using LBFactory::getMainLB() allows the shared database to
   *   reside on separate servers to the wiki's own database, with suitable
   *   configuration of $wgLBFactoryConf.
   */
@@@ -3237,6 -3237,14 +3237,14 @@@ $wgHTMLFormAllowTableFormat = true
   */
  $wgUseMediaWikiUIEverywhere = false;
  
+ /**
+  * Temporary variable that determines whether the EditPage class should use OOjs UI or not.
+  * This will be removed later and OOjs UI will become the only option.
+  *
+  * @since 1.32
+  */
+ $wgOOUIPreferences = false;
  /**
   * Whether to label the store-to-database-and-show-to-others button in the editor
   * as "Save page"/"Save changes" if false (the default) or, if true, instead as
@@@ -3372,12 -3380,23 +3380,12 @@@ $wgApiFrameOptions = 'DENY'
   */
  $wgDisableOutputCompression = false;
  
 -/**
 - * Abandoned experiment with HTML5-style ID escaping. Normalized IDs a bit
 - * too aggressively, breaking preexisting content (particularly Cite).
 - * See T29733, T29694, T29474.
 - *
 - * @deprecated since 1.30, use $wgFragmentMode
 - */
 -$wgExperimentalHtmlIds = false;
 -
  /**
   * How should section IDs be encoded?
   * This array can contain 1 or 2 elements, each of them can be one of:
   * - 'html5'  is modern HTML5 style encoding with minimal escaping. Displays Unicode
   *            characters in most browsers' address bars.
   * - 'legacy' is old MediaWiki-style encoding, e.g. 啤酒 turns into .E5.95.A4.E9.85.92
 - * - 'html5-legacy' corresponds to DEPRECATED $wgExperimentalHtmlIds mode. DO NOT use
 - *            it for anything but migration off that mode (see below).
   *
   * The first element of this array specifies the primary mode of escaping IDs. This
   * is what users will see when they e.g. follow an [[#internal link]] to a section of
@@@ -4273,6 -4292,8 +4281,6 @@@ $wgAllowImageTag = false
   *    - RaggettInternalHHVM: Use the limited-functionality HHVM extension
   *    - RaggettInternalPHP: Use the PECL extension
   *    - RaggettExternal: Shell out to an external binary (tidyBin)
 - *    - Html5Depurate: Use external Depurate service
 - *    - Html5Internal: Use the Balancer library in PHP
   *    - RemexHtml: Use the RemexHtml library in PHP
   *
   *  - tidyConfigFile: Path to configuration file for any of the Raggett drivers
diff --combined languages/i18n/en.json
        "botpasswords-existing": "Existing bot passwords",
        "botpasswords-createnew": "Create a new bot password",
        "botpasswords-editexisting": "Edit an existing bot password",
 +      "botpasswords-label-needsreset": "(password needs reset)",
        "botpasswords-label-appid": "Bot name:",
        "botpasswords-label-create": "Create",
        "botpasswords-label-update": "Update",
        "botpasswords-restriction-failed": "Bot password restrictions prevent this login.",
        "botpasswords-invalid-name": "The username specified does not contain the bot password separator (\"$1\").",
        "botpasswords-not-exist": "User \"$1\" does not have a bot password named \"$2\".",
 +      "botpasswords-needs-reset": "The bot password for bot name \"$2\" of {{GENDER:$1|user}} \"$1\" must be reset.",
        "resetpass_forbidden": "Passwords cannot be changed",
        "resetpass_forbidden-reason": "Passwords cannot be changed: $1",
        "resetpass-no-info": "You must be logged in to access this page directly.",
        "prefs-watchlist-edits": "Maximum number of changes to show in watchlist:",
        "prefs-watchlist-edits-max": "Maximum number: 1000",
        "prefs-watchlist-token": "Watchlist token:",
+       "prefs-watchlist-managetokens": "Manage tokens",
        "prefs-misc": "Misc",
        "prefs-resetpass": "Change password",
        "prefs-changeemail": "Change or remove email address",
        "recentchangescount": "Number of edits to show in recent changes, page histories, and in logs, by default:",
        "prefs-help-recentchangescount": "Maximum number: 1000",
        "prefs-help-watchlist-token2": "This is the secret key to the web feed of your watchlist.\nAnyone who knows it will be able to read your watchlist, so do not share it.\nIf you need to, [[Special:ResetTokens|you can reset it]].",
+       "prefs-help-tokenmanagement": "You can see and reset the secret key for your account that can access the Web feed of your watchlist. Anyone who knows the key will be able to read your watchlist, so do not share it.",
        "savedprefs": "Your preferences have been saved.",
        "savedrights": "The user groups of {{GENDER:$1|$1}} have been saved.",
        "timezonelegend": "Time zone:",
        "recentchangeslinked-feed": "Related changes",
        "recentchangeslinked-toolbox": "Related changes",
        "recentchangeslinked-title": "Changes related to \"$1\"",
 -      "recentchangeslinked-summary": "Enter a page name to see changes on pages linked to or from that page. (To see members of a category, enter Category:Name of category). Changes to pages on [[Special:Watchlist|your Watchlist]] are in <strong>bold</strong>.",
 +      "recentchangeslinked-summary": "Enter a page name to see changes on pages linked to or from that page. (To see members of a category, enter {{ns:category}}:Name of category). Changes to pages on [[Special:Watchlist|your Watchlist]] are in <strong>bold</strong>.",
        "recentchangeslinked-page": "Page name:",
        "recentchangeslinked-to": "Show changes to pages linked to the given page instead",
        "recentchanges-page-added-to-category": "[[:$1]] added to category",
diff --combined languages/i18n/qqq.json
                        "Gombang",
                        "Trizek (WMF)",
                        "Acamicamacaraca",
 -                      "Avatar6"
 +                      "Avatar6",
 +                      "Akapochtli"
                ]
        },
        "sidebar": "{{notranslate}}",
        "botpasswords-existing": "Form section label for the part of the form listing the user's existing bot passwords.",
        "botpasswords-createnew": "Form section label for the part of the form related to creating a new bot password.",
        "botpasswords-editexisting": "Form section label for the part of the form related to editing an existing bot password.",
 +      "botpasswords-label-needsreset": "Indicator for when an existing bot password is invalid and needs to be reset.",
        "botpasswords-label-appid": "Form field label for the \"bot name\", internally known as the \"application ID\".",
        "botpasswords-label-create": "Button label for the button to create a new bot password.\n{{Identical|Create}}",
        "botpasswords-label-update": "Button label for the button to save changes to a bot password.\n{{Identical|Update}}",
        "botpasswords-restriction-failed": "Error message when login is rejected because the configured restrictions were not satisfied.",
        "botpasswords-invalid-name": "Error message when a username lacking the separator character is passed to BotPassword. Parameters:\n* $1 - The separator character.",
        "botpasswords-not-exist": "Error message when a username exists but does not a bot password for the given \"bot name\". Parameters:\n* $1 - username\n* $2 - bot name",
 +      "botpasswords-needs-reset": "Error message when a bot password exists but needs to be reset. Parameters:\n* $1 - username\n* $2 - bot name",
        "resetpass_forbidden": "Used as error message in changing password. Maybe the external auth plugin won't allow local password changes.",
        "resetpass_forbidden-reason": "Like {{msg-mw|resetpass_forbidden}} but the auth provider gave a reason.\n\nParameters:\n* $1 - reason given by auth provider",
        "resetpass-no-info": "Error message for [[Special:ChangePassword]].\n\nParameters:\n* $1 (unused) - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description",
        "prefs-watchlist-edits": "Used in [[Special:Preferences]], tab \"Watchlist\".",
        "prefs-watchlist-edits-max": "Shown as hint in [[Special:Preferences]], tab \"Watchlist\"",
        "prefs-watchlist-token": "Used in [[Special:Preferences]], tab Watchlist.",
+       "prefs-watchlist-managetokens": "Label for the button to see and reset the user's private tokens",
        "prefs-misc": "Tab used on the [[Special:Preferences|user preferences]] special page.",
        "prefs-resetpass": "Button on user data tab in user preferences. When you click the button you go to the special page [[Special:ResetPass]].\n\n{{Identical|Change password}}",
        "prefs-changeemail": "Link on [[Special:Preferences]] to [[Special:ChangeEmail]]. [[Special:ChangeEmail]] also allows removing email address. \n\nSee also:\n* {{msg-mw|prefs-help-email-required|help}}\n* {{msg-mw|prefs-help-email|help}}\n* {{msg-mw|prefs-help-email-others|help}}\n* {{msg-mw|prefs-setemail|link title}}",
        "recentchangescount": "Used in [[Special:Preferences]], tab \"Recent changes\".",
        "prefs-help-recentchangescount": "Used in [[Special:Preferences]], tab \"Recent changes\".",
        "prefs-help-watchlist-token2": "Used in [[Special:Preferences]], tab Watchlist. (Formerly in {{msg-mw|prefs-help-watchlist-token}}.)",
+       "prefs-help-tokenmanagement": "Used in [[Special:Preferences]], Watchlist tab.",
        "savedprefs": "This message appears after saving changes to your user preferences.",
        "savedrights": "This message appears after saving the user groups on [[Special:UserRights]].\n* $1 - The user name of the user which groups was saved.",
        "timezonelegend": "{{Identical|Time zone}}",
diff --combined resources/Resources.php
@@@ -113,20 -113,6 +113,20 @@@ return 
                ],
        ],
  
 +      'jquery.tablesorter.styles' => [
 +              'targets' => [ 'desktop', 'mobile' ],
 +              'styles' => [
 +                      'resources/src/jquery/jquery.tablesorter.styles.less',
 +              ],
 +      ],
 +      'jquery.makeCollapsible.styles' => [
 +              'targets' => [ 'desktop', 'mobile' ],
 +              'class' => ResourceLoaderLessVarFileModule::class,
 +              'styles' => [
 +                      'resources/src/jquery/jquery.makeCollapsible.styles.less',
 +              ],
 +      ],
 +
        'mediawiki.skinning.content.parsoid' => [
                // Style Parsoid HTML+RDFa output consistent with wikitext from PHP parser
                // with the interface.css styles; skinStyles should be used if your
                'scripts' => 'resources/src/jquery/jquery.localize.js',
        ],
        'jquery.makeCollapsible' => [
 +              'dependencies' => [ 'jquery.makeCollapsible.styles' ],
                'scripts' => 'resources/src/jquery/jquery.makeCollapsible.js',
                'styles' => 'resources/src/jquery/jquery.makeCollapsible.css',
                'messages' => [ 'collapsible-expand', 'collapsible-collapse' ],
                'styles' => 'resources/src/jquery/jquery.tablesorter.less',
                'messages' => [ 'sort-descending', 'sort-ascending' ],
                'dependencies' => [
 +                      'jquery.tablesorter.styles',
                        'mediawiki.RegExp',
                        'mediawiki.language.months',
                ],
        'moment' => [
                'scripts' => [
                        // HACK: For some reason if you don't define window.moment first, loading moment fatals
 -                      'resources/src/moment-global.js',
 +                      'resources/src/moment/moment-global.js',
                        'resources/lib/moment/moment.js',
                ],
                'languageScripts' => [
                        'de-ch' => 'resources/lib/moment/locale/de-ch.js',
                        'dv' => 'resources/lib/moment/locale/dv.js',
                        'el' => 'resources/lib/moment/locale/el.js',
 -                      'en' => 'resources/src/moment-dmy.js',
 +                      'en' => 'resources/src/moment/moment-dmy.js',
                        'en-au' => 'resources/lib/moment/locale/en-au.js',
                        'en-ca' => 'resources/lib/moment/locale/en-ca.js',
                        'en-gb' => 'resources/lib/moment/locale/en-gb.js',
                // after locale definitions
                'skinScripts' => [
                        'default' => [
 -                              'resources/src/moment-locale-overrides.js',
 +                              'resources/src/moment/moment-locale-overrides.js',
                        ],
                ],
                'dependencies' => [
                        'mediawiki.api',
                ],
        ],
 -      'mediawiki.sectionAnchor' => [
 -              // Back-compat to hide it on cached pages (T18691; Ie9e334e973; 2015-03-17)
 -              'styles' => 'resources/src/mediawiki/mediawiki.sectionAnchor.css',
 -              'targets' => [ 'desktop', 'mobile' ],
 -      ],
        'mediawiki.storage' => [
                'scripts' => 'resources/src/mediawiki/mediawiki.storage.js',
                'targets' => [ 'desktop', 'mobile' ],
        ],
  
        'mediawiki.libs.pluralruleparser' => [
 -              'scripts' => 'resources/src/mediawiki.libs/CLDRPluralRuleParser.js',
 +              'scripts' => [
 +                      'resources/lib/CLDRPluralRuleParser/CLDRPluralRuleParser.js',
 +                      'resources/src/mediawiki.libs.pluralruleparser/export.js',
 +              ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
  
        /* MediaWiki Libs */
  
        'mediawiki.libs.jpegmeta' => [
 -              'scripts' => 'resources/src/mediawiki.libs/mediawiki.libs.jpegmeta.js',
 +              'scripts' => [
 +                      'resources/src/mediawiki.libs.jpegmeta/jpegmeta.js',
 +                      'resources/src/mediawiki.libs.jpegmeta/export.js',
 +              ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
  
                'scripts' => [
                        'resources/src/mediawiki.special/mediawiki.special.preferences.confirmClose.js',
                        'resources/src/mediawiki.special/mediawiki.special.preferences.convertmessagebox.js',
-                       'resources/src/mediawiki.special/mediawiki.special.preferences.tabs.js',
+                       'resources/src/mediawiki.special/mediawiki.special.preferences.tabs.legacy.js',
                        'resources/src/mediawiki.special/mediawiki.special.preferences.timezone.js',
                        'resources/src/mediawiki.special/mediawiki.special.preferences.personalEmail.js',
                ],
                ],
        ],
        'mediawiki.special.preferences.styles' => [
+               'targets' => [ 'desktop', 'mobile' ],
+               'styles' => 'resources/src/mediawiki.special/mediawiki.special.preferences.styles.legacy.css',
+       ],
+       'mediawiki.special.preferences.ooui' => [
+               'targets' => [ 'desktop', 'mobile' ],
+               'scripts' => [
+                       'resources/src/mediawiki.special/mediawiki.special.preferences.confirmClose.js',
+                       'resources/src/mediawiki.special/mediawiki.special.preferences.convertmessagebox.js',
+                       'resources/src/mediawiki.special/mediawiki.special.preferences.editfont.js',
+                       'resources/src/mediawiki.special/mediawiki.special.preferences.tabs.js',
+                       'resources/src/mediawiki.special/mediawiki.special.preferences.timezone.js',
+                       'resources/src/mediawiki.special/mediawiki.special.preferences.personalEmail.js',
+               ],
+               'messages' => [
+                       'prefs-tabs-navigation-hint',
+                       'prefswarning-warning',
+                       'saveprefs',
+                       'savedprefs',
+               ],
+               'dependencies' => [
+                       'mediawiki.language',
+                       'mediawiki.confirmCloseWindow',
+                       'mediawiki.notification.convertmessagebox',
+                       'oojs-ui-widgets',
+                       'mediawiki.widgets.SelectWithInputWidget',
+                       'mediawiki.editfont.styles',
+               ],
+       ],
+       'mediawiki.special.preferences.styles.ooui' => [
                'targets' => [ 'desktop', 'mobile' ],
                'styles' => 'resources/src/mediawiki.special/mediawiki.special.preferences.styles.css',
        ],
@@@ -117,7 -117,7 +117,7 @@@ class DefaultPreferencesFactoryTest ext
                $configMock = new HashConfig( [
                        'HiddenPrefs' => []
                ] );
-               $form = $this->getMockBuilder( PreferencesForm::class )
+               $form = $this->getMockBuilder( PreferencesFormLegacy::class )
                        ->disableOriginalConstructor()
                        ->getMock();
  
  
        /**
         * The rclimit preference should accept non-integer input and filter it to become an integer.
 +       *
 +       * @covers \MediaWiki\Preferences\DefaultPreferencesFactory::saveFormData
         */
        public function testIntvalFilter() {
                // Test a string with leading zeros (i.e. not octal) and spaces.