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

Change subject: Fix ApiSandbox
......................................................................


Fix ApiSandbox

I2b8ef74e broke it by removing the isValid() method from
TextInputWidget.

Bug: T150454
Change-Id: Iae48c6e038ce66d294a1bf5f6852e29540ac208c
---
M resources/src/mediawiki.special/mediawiki.special.apisandbox.js
1 file changed, 13 insertions(+), 6 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  Jforrester: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js 
b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
index 98ed3ee..a206328 100644
--- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
+++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
@@ -26,7 +26,11 @@
                        },
                        apiCheckValid: function () {
                                var that = this;
-                               return this.isValid().done( function ( ok ) {
+                               return this.getValidity().then( function () {
+                                       return $.Deferred().resolve( true 
).promise();
+                               }, function () {
+                                       return $.Deferred().resolve( false 
).promise();
+                               } ).done( function ( ok ) {
                                        ok = ok || suppressErrors;
                                        that.setIcon( ok ? null : 'alert' );
                                        that.setIconTitle( ok ? '' : 
mw.message( 'apisandbox-alert-field' ).plain() );
@@ -35,9 +39,12 @@
                },
 
                dateTimeInputWidget: {
-                       isValid: function () {
-                               var ok = !Util.apiBool( this.paramInfo.required 
) || this.getApiValue() !== '';
-                               return $.Deferred().resolve( ok ).promise();
+                       getValidity: function () {
+                               if ( !Util.apiBool( this.paramInfo.required ) 
|| this.getApiValue() !== '' ) {
+                                       return $.Deferred().resolve().promise();
+                               } else {
+                                       return $.Deferred().reject().promise();
+                               }
                        }
                },
 
@@ -372,7 +379,7 @@
                                        } );
                                        widget.setIcon = 
widget.input.setIcon.bind( widget.input );
                                        widget.setIconTitle = 
widget.input.setIconTitle.bind( widget.input );
-                                       widget.isValid = 
widget.input.isValid.bind( widget.input );
+                                       widget.getValidity = 
widget.input.getValidity.bind( widget.input );
                                        widget.paramInfo = pi;
                                        $.extend( widget, 
WidgetMethods.textInputWidget );
                                        if ( Util.apiBool( pi.enforcerange ) ) {
@@ -388,7 +395,7 @@
                                        } );
                                        widget.setIcon = 
widget.input.setIcon.bind( widget.input );
                                        widget.setIconTitle = 
widget.input.setIconTitle.bind( widget.input );
-                                       widget.isValid = 
widget.input.isValid.bind( widget.input );
+                                       widget.getValidity = 
widget.input.getValidity.bind( widget.input );
                                        widget.input.setValidation( function ( 
value ) {
                                                return value === 'max' || 
widget.validateNumber( value );
                                        } );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iae48c6e038ce66d294a1bf5f6852e29540ac208c
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Bartosz DziewoƄski <matma....@gmail.com>
Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
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