Changeset 23057
- Timestamp:
- 12/05/2012 02:31:41 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-models.js
r23045 r23057 143 143 // Use with PHP's wp_send_json_success() and wp_send_json_error() 144 144 $.ajax( options ).done( function( response ) { 145 // Treat a response of `1` as successful for backwards 146 // compatibility with existing handlers. 147 if ( response === '1' || response === 1 ) 148 response = { success: true }; 149 145 150 if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) 146 151 deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] ); … … 265 270 } else if ( 'delete' === method ) { 266 271 options = options || {}; 272 273 if ( ! options.wait ) 274 this.destroyed = true; 275 267 276 options.context = this; 268 277 options.data = _.extend( options.data || {}, { … … 271 280 _wpnonce: this.get('nonces')['delete'] 272 281 }); 273 return media.ajax( options ); 282 283 return media.ajax( options ).done( function() { 284 this.destroyed = true; 285 }).fail( function() { 286 this.destroyed = false; 287 }); 274 288 } 275 289 }, … … 402 416 }, 403 417 418 validateDestroyed: false, 419 404 420 validator: function( attachment ) { 421 if ( ! this.validateDestroyed && attachment.destroyed ) 422 return false; 405 423 return _.all( this.filters, function( filter, key ) { 406 424 return !! filter.call( this, attachment );
Note: See TracChangeset
for help on using the changeset viewer.