jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/389970 )
Change subject: Add params to warning messages about present-day public domain
uploads
......................................................................
Add params to warning messages about present-day public domain uploads
We didn't supply all params to the license messages for
the warning that is displayed in case of a current-day
upload of a public domain file.
This needs a change in makeMessage to allow raw HTML,
instead of escaping it (for the <a> elements), which
should be fine since we'll only allow it for message
object, which are created in code - they're not random
user input.
Bug: T175827
Change-Id: I985ca8e7c79bcf47fa72e7a3affa73cf9da73853
---
M resources/details/uw.DateDetailsWidget.js
M resources/uw.ValidationMessageElement.js
2 files changed, 8 insertions(+), 3 deletions(-)
Approvals:
MarkTraceur: Looks good to me, approved
jenkins-bot: Verified
Cparle: Verified; Looks good to me, but someone else must approve
diff --git a/resources/details/uw.DateDetailsWidget.js
b/resources/details/uw.DateDetailsWidget.js
index a3aa084..077fb51 100644
--- a/resources/details/uw.DateDetailsWidget.js
+++ b/resources/details/uw.DateDetailsWidget.js
@@ -118,6 +118,8 @@
*/
uw.DateDetailsWidget.prototype.getWarnings = function () {
var i,
+ license,
+ licenseMsg,
warnings = [],
dateVal = Date.parse(
this.dateInputWidget.getValue().trim() ),
licenses = this.getLicenses(),
@@ -141,7 +143,9 @@
if ( now.toISOString().slice( 0, 10 ) ===
date.toISOString().slice( 0, 10 ) ) {
for ( i in warnLicenses ) {
if ( warnLicenses[ i ] in licenses ) {
- warnings.push( mw.message(
'mwe-upwiz-error-date-license-unlikely', mw.message( licenses[ warnLicenses[ i
] ].msg ).parse() ) );
+ license = licenses[
warnLicenses[ i ] ];
+ licenseMsg = mw.message(
license.msg, 0, license.url ? license.url : '#missing license URL' );
+ warnings.push( mw.message(
'mwe-upwiz-error-date-license-unlikely', licenseMsg.parse() ) );
}
}
}
diff --git a/resources/uw.ValidationMessageElement.js
b/resources/uw.ValidationMessageElement.js
index 2f941c0..3870781 100644
--- a/resources/uw.ValidationMessageElement.js
+++ b/resources/uw.ValidationMessageElement.js
@@ -68,13 +68,14 @@
*/
uw.ValidationMessageElement.prototype.makeMessage = function ( kind,
error ) {
var code, content, $listItem;
- if ( error.parseDom ) {
+ if ( error.parse ) {
code = error.key;
- content = error.parseDom();
+ content = new OO.ui.HtmlSnippet( error.parse() );
} else {
code = error.code;
content = $( $.parseHTML( error.html ) );
}
+
$listItem = OO.ui.FieldLayout.prototype.makeMessage.call( this,
kind, content )
.addClass( 'mwe-upwiz-fieldLayout-' + kind + '-' + code
);
return $listItem;
--
To view, visit https://gerrit.wikimedia.org/r/389970
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I985ca8e7c79bcf47fa72e7a3affa73cf9da73853
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
Gerrit-Reviewer: Cparle <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits