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

Change subject: Hygiene: Add documentation for PhotoApi
......................................................................


Hygiene: Add documentation for PhotoApi

Change-Id: I85f3123b1cee7fb8194a4fb5421f9d35061dbb34
---
M javascripts/modules/uploads/PhotoApi.js
1 file changed, 18 insertions(+), 3 deletions(-)

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



diff --git a/javascripts/modules/uploads/PhotoApi.js 
b/javascripts/modules/uploads/PhotoApi.js
index 168a189..2f8bc0f 100644
--- a/javascripts/modules/uploads/PhotoApi.js
+++ b/javascripts/modules/uploads/PhotoApi.js
@@ -79,8 +79,14 @@
                // 
https://commons.wikimedia.org/wiki/MediaWiki:Titleblacklist-custom-double-apostrophe
                name = name.replace( /''/g, '\'_' );
 
-               function pad( Number ) {
-                       return Number < 10 ? '0' + Number : Number;
+               /**
+                * Pad single digit numbers with leading 0.
+                * @param {Number} number
+                * @ignore
+                * @returns {Number|String} representing number with at least 2 
digits
+                */
+               function pad( number ) {
+                       return number < 10 ? '0' + number : number;
                }
 
                suffix = ' ' + date.getUTCFullYear() + '-' +
@@ -112,7 +118,15 @@
                        this.editorApi = options.editorApi;
                },
 
-               // FIXME: See UploadBase::checkWarnings - why these are not 
errors only the MediaWiki Gods know See Bug 48261
+               /**
+                * Applies special handling for uploads which fail due to a 
lack of filename.
+                * Scans the warnings and tries to construct a suitable error 
message.
+                * FIXME: See UploadBase::checkWarnings - why these are not 
errors only the MediaWiki Gods know See Bug 48261
+                * @private
+                * @param {jQuery.Deferred} result from an upload api request.
+                * @param {Object} warnings as found in the 
data.upload.warnings.
+                *  FIXME: This is part of the result and thus is an 
unnecessary parameter.
+                */
                _handleWarnings: function ( result, warnings ) {
                        var humanErrorMsg,
                                err = {
@@ -231,6 +245,7 @@
                                        options.fileName = data.upload.filename;
 
                                        if ( !options.fileName ) {
+                                               // FIXME: Handle this case as 
an error in handleWarnings
                                                if ( warnings && 
warnings.duplicate ) {
                                                        options.fileName = 
warnings.duplicate[ '0' ];
                                                } else if ( warnings ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I85f3123b1cee7fb8194a4fb5421f9d35061dbb34
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: Bmansurov <bmansu...@wikimedia.org>
Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to