Make WordPress Core

Ticket #24753: 24753.3.diff

File 24753.3.diff, 1.2 KB (added by garyc40, 12 years ago)

This is to be patched against latest trunk

  • wp-includes/js/media-models.js

    window.wp = window.wp || {}; 
    401401
    402402                        attachments.on( 'add change remove', this._validateHandler, this );
    403403                        attachments.on( 'reset', this._validateAllHandler, this );
    404 
    405404                        this.validateAll( attachments );
    406405                        return this;
    407406                },
    window.wp = window.wp || {}; 
    487486                                resp = [resp];
    488487
    489488                        return _.map( resp, function( attrs ) {
    490                                 var id, attachment;
     489                                var id, attachment, newAttributes;
     490
    491491                                if ( attrs instanceof Backbone.Model ) {
    492492                                        id = attrs.get( 'id' );
    493493                                        attrs = attrs.attributes;
    window.wp = window.wp || {}; 
    495495                                        id = attrs.id;
    496496                                }
    497497
    498                                 attachment = Attachment.get( attrs.id );
    499                                 if ( ! _.isEqual( attachment.attributes, attrs ) )
    500                                         attachment.set( attachment.parse( attrs, xhr ) );
     498                                attachment = Attachment.get( id );
     499                                newAttributes = attachment.parse( attrs, xhr );
     500
     501                                if ( ! _.isEqual( attachment.attributes, newAttributes ) )
     502                                        attachment.set( newAttributes );
    501503
    502504                                return attachment;
    503505                        });