jenkins-bot has submitted this change and it was merged.

Change subject: Define required 'defaults' field in licensing config, correct 
the code using it
......................................................................


Define required 'defaults' field in licensing config, correct the code using it

This doesn't yet mean that the 'defaults' specified in a campaign
definition is respected... it just doesn't throw exceptions anymore.
Something else is overriding it later, not quite sure what or why. Eh.

Bug: T65494
Bug: T123840
Change-Id: I18ffad4c627c33156c96e1a44dcd3518fb914921
---
M UploadWizard.config.php
M resources/mw.UploadWizardDeedOwnWork.js
M resources/mw.UploadWizardDeedThirdParty.js
M resources/mw.UploadWizardLicenseInput.js
4 files changed, 7 insertions(+), 7 deletions(-)

Approvals:
  MarkTraceur: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/UploadWizard.config.php b/UploadWizard.config.php
index c86e3ef..3e9d5d1 100644
--- a/UploadWizard.config.php
+++ b/UploadWizard.config.php
@@ -434,6 +434,7 @@
                'ownWork' => array(
                        'type' => 'or',
                        'template' => 'self',
+                       'defaults' => 'cc-by-sa-4.0',
                        'licenses' => array(
                                'cc-by-sa-4.0',
                                'cc-by-sa-3.0',
@@ -446,6 +447,7 @@
                // checkbox selection of all licenses
                'thirdParty' => array(
                        'type' => 'or',
+                       'defaults' => 'cc-by-sa-4.0',
                        'licenseGroups' => array(
                                array(
                                        // This should be a list of all CC 
licenses we can reasonably expect to find around the web
diff --git a/resources/mw.UploadWizardDeedOwnWork.js 
b/resources/mw.UploadWizardDeedOwnWork.js
index 43ec4d9..56977ab 100644
--- a/resources/mw.UploadWizardDeedOwnWork.js
+++ b/resources/mw.UploadWizardDeedOwnWork.js
@@ -75,7 +75,7 @@
                                        defaultType = 
config.licensing.defaultType;
 
                                if ( defaultType === 'ownwork' ) {
-                                       defaultLicense = 
config.licensing.ownWork.defaults[ 0 ];
+                                       defaultLicense = 
config.licensing.ownWork.defaults;
                                } else {
                                        defaultLicense = 
config.licensing.ownWork.licenses[ 0 ];
                                }
@@ -118,7 +118,7 @@
                                defaultType = config.licensing.defaultType;
 
                                if ( defaultType === 'ownwork' ) {
-                                       defaultLicense = 
config.licensing.ownWork.defaults[ 0 ];
+                                       defaultLicense = 
config.licensing.ownWork.defaults;
                                } else {
                                        defaultLicense = 
config.licensing.ownWork.licenses[ 0 ];
                                }
diff --git a/resources/mw.UploadWizardDeedThirdParty.js 
b/resources/mw.UploadWizardDeedThirdParty.js
index 988ec0f..49c5d40 100644
--- a/resources/mw.UploadWizardDeedThirdParty.js
+++ b/resources/mw.UploadWizardDeedThirdParty.js
@@ -150,7 +150,7 @@
                                $selector.append( this.$form );
 
                                if ( defaultType === 'thirdparty' ) {
-                                       defaultLicense = 
config.licensing.thirdParty.defaults[ 0 ];
+                                       defaultLicense = 
config.licensing.thirdParty.defaults;
 
                                        defaultLicenseNum = 
findLicenseRecursively( config, defaultLicense );
 
diff --git a/resources/mw.UploadWizardLicenseInput.js 
b/resources/mw.UploadWizardLicenseInput.js
index 834512b..9e327a7 100644
--- a/resources/mw.UploadWizardLicenseInput.js
+++ b/resources/mw.UploadWizardLicenseInput.js
@@ -94,7 +94,7 @@
 
                this.defaults = [];
 
-               if ( config.defaults && config.defaults[ 0 ] ) {
+               if ( config.defaults ) {
                        this.defaults = config.defaults;
                } else if ( config.licenses && config.licenses[ 0 ] ) {
                        this.defaults = [ config.licenses[ 0 ] ];
@@ -442,9 +442,7 @@
                 */
                setDefaultValues: function () {
                        var values = {};
-                       $.each( this.defaults, function ( i, lic ) {
-                               values[ lic ] = true;
-                       } );
+                       values[ this.defaults ] = true;
                        this.setValues( values );
                },
 

-- 
To view, visit https://gerrit.wikimedia.org/r/264697
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I18ffad4c627c33156c96e1a44dcd3518fb914921
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to