Make WordPress Core

Changeset 27536


Ignore:
Timestamp:
03/14/2014 12:59:28 PM (10 years ago)
Author:
wonderboymusic
Message:

In media.model.PostMedia, for these 2 scenarios:

  • src is set, and 'Add a Source' results in the same file (or a file with the same extension) being added
  • src is set, and 'Replace Audio|Video' is used, which will add a model property named by the attachment's extension

... call model.unset( 'src' ).

See #27389.

File:
1 edited

Legend:

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

    r27530 r27536  
    468468            this.extension = attachment.get('filename' ).split('.').pop();
    469469
     470            if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) {
     471                this.unset( 'src' );
     472            }
     473
    470474            if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) {
    471475                this.set( this.extension, this.attachment.get( 'url' ) );
     
    480484            this.setSource( attachment );
    481485
     486            this.unset( 'src' );
    482487            _.each( _.without( wp.media.view.settings.embedExts, this.extension ), function (ext) {
    483488                self.unset( ext );
Note: See TracChangeset for help on using the changeset viewer.