Merge "Revert "Prevent new users from being sent emails""
[lhc/web/wiklou.git] / resources / src / mediawiki / api.js
index b4639ab..2e5a92e 100644 (file)
@@ -42,7 +42,7 @@
                        'import',
                        'options'
                ];
-               if ( $.inArray( action, csrfActions ) !== -1 ) {
+               if ( csrfActions.indexOf( action ) !== -1 ) {
                        mw.track( 'mw.deprecate', 'apitoken_' + action );
                        mw.log.warn( 'Use of the "' + action + '" token is deprecated. Use "csrf" instead.' );
                        return 'csrf';
                 * @method
                 */
                abort: function () {
-                       $.each( this.requests, function ( index, request ) {
+                       this.requests.forEach( function ( request ) {
                                if ( request ) {
                                        request.abort();
                                }
                                        } else {
                                                parameters[ key ] = '\x1f' + parameters[ key ].join( '\x1f' );
                                        }
-                               }
-                               // Boolean values are only false when not given at all
-                               if ( parameters[ key ] === false || parameters[ key ] === undefined ) {
+                               } else if ( parameters[ key ] === false || parameters[ key ] === undefined ) {
+                                       // Boolean values are only false when not given at all
                                        delete parameters[ key ];
                                }
                        }
                                        return abortedPromise;
                                }
 
-                               return ( abortable = api.post( params, ajaxOptions ) ).then(
-                                       // If no error, return to caller as-is
-                                       null,
+                               return ( abortable = api.post( params, ajaxOptions ) ).catch(
                                        // Error handler
                                        function ( code ) {
                                                if ( code === 'badtoken' ) {