From 9efb4296f06a5f65c3d8004cc7372ddd74ef48c9 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 26 Jul 2019 11:03:24 -0400 Subject: [PATCH] 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 --- resources/src/mediawiki.special.apisandbox/apisandbox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(); } -- 2.20.1