Make WordPress Core

Ticket #32746: 32746.diff

File 32746.diff, 1.6 KB (added by wonderboymusic, 11 years ago)
  • src/wp-includes/js/media/models/attachments.js

     
    493493                type: function( attachment ) {
    494494                        var type = this.props.get('type'), atts = attachment.toJSON(), mime, found;
    495495
     496                        if ( ! type || ( _.isArray( type ) && ! type.length ) ) {
     497                                return true;
     498                        }
     499
    496500                        mime = atts.mime || ( atts.file && atts.file.type ) || '';
    497501
    498502                        if ( _.isArray( type ) ) {
    499                                 found = ! type.length || _.find( type, function (t) {
     503                                found = _.find( type, function (t) {
    500504                                        return -1 !== mime.indexOf( t );
    501505                                } );
    502506                        } else {
    503                                 found = ! type || -1 !== mime.indexOf( type );
     507                                found = -1 !== mime.indexOf( type );
    504508                        }
    505509
    506510                        return found;
  • src/wp-includes/js/media-models.js

     
    897897                type: function( attachment ) {
    898898                        var type = this.props.get('type'), atts = attachment.toJSON(), mime, found;
    899899
     900                        if ( ! type || ( _.isArray( type ) && ! type.length ) ) {
     901                                return true;
     902                        }
     903
    900904                        mime = atts.mime || ( atts.file && atts.file.type ) || '';
    901905
    902906                        if ( _.isArray( type ) ) {
    903                                 found = ! type.length || _.find( type, function (t) {
     907                                found = _.find( type, function (t) {
    904908                                        return -1 !== mime.indexOf( t );
    905909                                } );
    906910                        } else {
    907                                 found = ! type || -1 !== mime.indexOf( type );
     911                                found = -1 !== mime.indexOf( type );
    908912                        }
    909913
    910914                        return found;