Allow configuring distinct upload dialog comments for local/foreign uploads
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 8 Jun 2016 17:01:41 +0000 (19:01 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 8 Jun 2016 17:06:53 +0000 (19:06 +0200)
Change-Id: I192d6989af9613730a1e0b8ce077e651bc450d37

RELEASE-NOTES-1.28
includes/DefaultSettings.php
resources/src/mediawiki/mediawiki.ForeignStructuredUpload.js

index a650a50..0e423d2 100644 (file)
@@ -11,6 +11,8 @@ production.
   user's language. If such access is attempted, an exception will be thrown.
 * The number of internal PBKDF2 iterations used to derive the session secret
   is configurable via $wgSessionPbkdf2Iterations.
+* Upload dialog's file upload log comment can now be configured separately for
+  local and foreign uploads.
 
 === New features in 1.28 ===
 * User::isBot() method for checking if an account is a bot role account.
@@ -23,19 +25,14 @@ production.
 
 ==== New external libraries ====
 
-
 ==== Removed and replaced external libraries ====
 
-
 === Bug fixes in 1.28 ===
 
-
 === Action API changes in 1.28 ===
 
-
 === Action API internal changes in 1.28 ===
 
-
 === Languages updated in 1.28 ===
 
 MediaWiki supports over 350 languages. Many localisations are updated
index 0fe3388..dc0b60c 100644 (file)
@@ -567,10 +567,14 @@ $wgUploadDialog = [
                // * upload-form-label-not-own-work-local-generic-foreign
                'foreign' => 'generic-foreign',
        ],
-       // Upload comment to use. Available replacements:
+       // Upload comments to use for 'local' and 'foreign' uploads. This can also be set to a single
+       // string value, in which case it is used for both kinds of uploads. Available replacements:
        // * $HOST - domain name from which a cross-wiki upload originates
        // * $PAGENAME - wiki page name from which an upload originates
-       'comment' => '',
+       'comment' => [
+               'local' => '',
+               'foreign' => '',
+       ],
        // Format of the file page wikitext to be generated from the fields input by the user.
        'format' => [
                // Wrapper for the whole page. Available replacements:
index b6248cf..3a0a94b 100644 (file)
         * @inheritdoc
         */
        ForeignStructuredUpload.prototype.getComment = function () {
-               return this.config.comment
+               var
+                       isLocal = this.target === 'local',
+                       comment = typeof this.config.comment === 'string' ?
+                               this.config.comment :
+                               this.config.comment[ isLocal ? 'local' : 'foreign' ];
+               return comment
                        .replace( '$PAGENAME', mw.config.get( 'wgPageName' ) )
                        .replace( '$HOST', location.host );
        };