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

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

Change subject: mw.UploadWizardDetails: Don't assume that a description is 
required
......................................................................

mw.UploadWizardDetails: Don't assume that a description is required

If an upload campaign defines custom fields, the default description
field is optional.

This would result in an exception at the 'Thanks' step (and the
thumbnails not being shown) if no description was provided. The
interface did not look very broken and was still functional, though.

Bug: T136234
Change-Id: I232e657340a22e9fcd281b70098ca80791a835a6
---
M resources/mw.UploadWizardDetails.js
1 file changed, 6 insertions(+), 1 deletion(-)


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

diff --git a/resources/mw.UploadWizardDetails.js 
b/resources/mw.UploadWizardDetails.js
index 143c468..ca93411 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -320,7 +320,12 @@
                 * Get a thumbnail caption for this upload (basically, the 
first description).
                 */
                getThumbnailCaption: function () {
-                       return 
this.descriptionsDetails.getSerialized().descriptions[ 0 ].description.trim();
+                       var descriptions = 
this.descriptionsDetails.getSerialized().descriptions;
+                       if ( descriptions.length > 0 ) {
+                               return descriptions[ 0 ].description.trim();
+                       } else {
+                               return '';
+                       }
                },
 
                /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I232e657340a22e9fcd281b70098ca80791a835a6
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