From: Bartosz DziewoƄski Date: Wed, 8 Jun 2016 17:01:41 +0000 (+0200) Subject: Allow configuring distinct upload dialog comments for local/foreign uploads X-Git-Tag: 1.31.0-rc.0~6623^2~1 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/fiche.php?a=commitdiff_plain;h=f082d9658399935840da10f0cff1ad87835ca127;p=lhc%2Fweb%2Fwiklou.git Allow configuring distinct upload dialog comments for local/foreign uploads Change-Id: I192d6989af9613730a1e0b8ce077e651bc450d37 --- diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28 index a650a50254..0e423d296c 100644 --- a/RELEASE-NOTES-1.28 +++ b/RELEASE-NOTES-1.28 @@ -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 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 0fe3388550..dc0b60c462 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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: diff --git a/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.js b/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.js index b6248cfa21..3a0a94b377 100644 --- a/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.js +++ b/resources/src/mediawiki/mediawiki.ForeignStructuredUpload.js @@ -149,7 +149,12 @@ * @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 ); };