From: Mark Holmquist Date: Thu, 30 Jul 2015 18:52:38 +0000 (-0500) Subject: Add getImageInfo to mw.Upload X-Git-Tag: 1.31.0-rc.0~10577^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=6114f46a487274cbe14789c0f66468cfd0118ae8;p=lhc%2Fweb%2Fwiklou.git Add getImageInfo to mw.Upload Just a little shortcut and so you don't need to rely on the promises. Bug: T107460 Change-Id: I1e36f3cd8cb6b50ec5db6d77512ce03cd98a2caf --- diff --git a/resources/src/mediawiki/mediawiki.Upload.js b/resources/src/mediawiki/mediawiki.Upload.js index 197ea6fc6a..b8425456a3 100644 --- a/resources/src/mediawiki/mediawiki.Upload.js +++ b/resources/src/mediawiki/mediawiki.Upload.js @@ -21,6 +21,8 @@ this.filename = null; this.file = null; this.state = Upload.State.NEW; + + this.imageinfo = undefined; } UP = Upload.prototype; @@ -146,6 +148,16 @@ return this.state; }; + /** + * Get the imageinfo object for the finished upload. + * Only available once the upload is finished! Don't try to get it + * beforehand. + * @return {Object|undefined} + */ + UP.getImageInfo = function () { + return this.imageinfo; + }; + /** * Upload the file directly. * @return {jQuery.Promise} @@ -170,6 +182,7 @@ text: this.text } ).then( function ( result ) { upload.state = Upload.State.UPLOADED; + upload.imageinfo = result.upload.imageinfo; return result; }, function () { upload.state = Upload.State.ERROR;