From: Brad Jorsch Date: Fri, 26 Jul 2019 15:03:24 +0000 (-0400) Subject: ApiSandbox: Fix upload widget X-Git-Tag: 1.34.0-rc.0~863^2 X-Git-Url: http://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=9efb4296f06a5f65c3d8004cc7372ddd74ef48c9;p=lhc%2Fweb%2Fwiklou.git ApiSandbox: Fix upload widget Attempting to send the request with an active upload widget was producing a JavaScript error "TypeError: this.setIcon is not a function". This was probably broken by Iaaa226ea. Further, validation was not working correctly since getValue() was returning undefined rather than null as documented. This was probably broken by I8d736fbb. Bug: T229123 Change-Id: I78a6f9f0cffcd229ec0ab80c2309a0ee2089c927 --- diff --git a/resources/src/mediawiki.special.apisandbox/apisandbox.js b/resources/src/mediawiki.special.apisandbox/apisandbox.js index 395fb8bd82..c2c59609e9 100644 --- a/resources/src/mediawiki.special.apisandbox/apisandbox.js +++ b/resources/src/mediawiki.special.apisandbox/apisandbox.js @@ -289,8 +289,8 @@ // Can't, sorry. }, apiCheckValid: function () { - var ok = this.getValue() !== null || suppressErrors; - this.setIcon( ok ? null : 'alert' ); + var ok = this.getValue() !== null && this.getValue() !== undefined || suppressErrors; + this.info.setIcon( ok ? null : 'alert' ); this.setTitle( ok ? '' : mw.message( 'apisandbox-alert-field' ).plain() ); return $.Deferred().resolve( ok ).promise(); }