Make WordPress Core

Changeset 34009


Ignore:
Timestamp:
09/10/2015 06:18:41 PM (9 years ago)
Author:
wonderboymusic
Message:

WP Plupload: on FileUploaded, allow success and error callbacks to receive server responses after a successful upload.

Props ippetkov.
Fixes #24934.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/plupload/wp-plupload.js

    r30244 r34009  
    263263            }
    264264
    265             if ( ! _.isObject( response ) || _.isUndefined( response.success ) )
     265            if ( ! _.isObject( response ) || _.isUndefined( response.success ) ) {
    266266                return error( pluploadL10n.default_error, null, file );
    267             else if ( ! response.success )
    268                 return error( response.data && response.data.message, response.data, file );
     267            } else if ( ! response.success && ! _.isObject( response.data ) ) {
     268                return error( response.data, null, file );
     269            } else {
     270                return error( response.data.message || pluploadL10n.default_error, response.data, file );
     271            }
    269272
    270273            _.each(['file','loaded','size','percent'], function( key ) {
     
    282285                Uploader.queue.reset();
    283286
    284             self.success( file.attachment );
     287            self.success( file.attachment, response.data );
    285288        });
    286289
Note: See TracChangeset for help on using the changeset viewer.