Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/249893

Change subject: mw.UploadWizardDeed: Do not assume that deed is always set
......................................................................

mw.UploadWizardDeed: Do not assume that deed is always set

Deed can be unset if the user chooses to select a license for each
file separately (in the Details step) and has not selected any yet.

This undoes some changes from 7a70dc81a0fd9fdbdcec8a053bc7900863d551be,
in particular restoring the message 'mwe-upwiz-deeds-need-deed'.

Change-Id: Ibfb447d0bcb6f4bd0a523a4fbc2dfe6e3f61f51e
---
M UploadWizardHooks.php
M i18n/en.json
M i18n/qqq.json
M resources/mw.UploadWizardDeed.js
4 files changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/93/249893/1

diff --git a/UploadWizardHooks.php b/UploadWizardHooks.php
index 377c255..103e49a 100644
--- a/UploadWizardHooks.php
+++ b/UploadWizardHooks.php
@@ -319,6 +319,7 @@
                                'mwe-upwiz-tooltip-location',
                                'mwe-upwiz-tooltip-more-info',
                                'mwe-upwiz-file-need-file',
+                               'mwe-upwiz-deeds-need-deed',
                                'mwe-upwiz-deeds-need-license',
                                'mwe-upwiz-license-show-all',
                                'mwe-upwiz-license-show-recommended',
diff --git a/i18n/en.json b/i18n/en.json
index 7715c28..9c2eee4 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -189,6 +189,7 @@
        "mwe-upwiz-tooltip-location": "[$1 Geocode your file] to identify where 
the media was recorded (it is not always useful to enter a location for every 
kind of media).",
        "mwe-upwiz-tooltip-more-info": "Learn more.",
        "mwe-upwiz-file-need-file": "Please add an upload first.",
+       "mwe-upwiz-deeds-need-deed": "Please explain where you got this file 
and how this site can use it, by selecting one of the options.",
        "mwe-upwiz-deeds-need-license": "Please select a license.",
        "mwe-upwiz-license-show-all": "Use a different license",
        "mwe-upwiz-license-show-recommended": "Use the site's recommended 
license",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 1900e9e..b29dc71 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -212,6 +212,7 @@
        "mwe-upwiz-tooltip-location": "A tooltip documenting the location 
picker for UploadWizard, currently three coordinate text fields.",
        "mwe-upwiz-tooltip-more-info": "{{Identical|Learn more}}",
        "mwe-upwiz-file-need-file": "Requests that the user add a file to the 
form before proceeding.",
+       "mwe-upwiz-deeds-need-deed": "Informs the user that they must provide 
the source and author of a file before proceeding.",
        "mwe-upwiz-deeds-need-license": "Informs the user that they must choose 
a license before proceeding.",
        "mwe-upwiz-license-show-all": "Used as action link text.\n\nSee 
also:\n* {{msg-mw|Mwe-upwiz-license-show-recommended}}",
        "mwe-upwiz-license-show-recommended": "Used as action link text.\n\nSee 
also:\n* {{msg-mw|Mwe-upwiz-license-show-all}}",
diff --git a/resources/mw.UploadWizardDeed.js b/resources/mw.UploadWizardDeed.js
index 74c8562..98ffc52 100644
--- a/resources/mw.UploadWizardDeed.js
+++ b/resources/mw.UploadWizardDeed.js
@@ -522,17 +522,17 @@
                 * @return {boolean} true if valid, false if not
                 */
                valid: function () {
-                       // we assume there is always a deed available, even if 
it's just the null deed.
-                       var valid = this.deed.valid();
-                       // the only time we need to set an error message is if 
the null deed is selected.
+                       var valid = this.deed && this.deed.valid();
+                       // the only time we need to set an error message is if 
no deed is selected.
                        // otherwise, we can assume that the widgets have 
already added error messages.
                        if ( valid ) {
                                this.hideError();
+                       } else if ( !this.deed ) {
+                               this.showError( mw.message( 
'mwe-upwiz-deeds-need-deed' ).parse() );
                        }
                        return valid;
                },
 
-               // FIXME does not seem to be used
                showError: function ( error ) {
                        uw.eventFlowLogger.logError( 'deeds', { message: error 
} );
                        this.$errorEl.html( error );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfb447d0bcb6f4bd0a523a4fbc2dfe6e3f61f51e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

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

Reply via email to