When filtering media by type in `wp.media.model.Attachments.filters.type()`, account for the library's `type` being an array of full mime-types.

Fixes #32746.

Built from https://develop.svn.wordpress.org/trunk@32915


git-svn-id: http://core.svn.wordpress.org/trunk@32886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-06-23 19:40:26 +00:00
parent 3b88c839f9
commit 15bfe75f88
3 changed files with 15 additions and 4 deletions

View File

@ -895,8 +895,19 @@ var Attachments = Backbone.Collection.extend({
* @returns {Boolean}
*/
type: function( attachment ) {
var type = this.props.get('type');
return ! type || -1 !== type.indexOf( attachment.get('type') );
var type = this.props.get('type'), atts = attachment.toJSON(), mime, found;
mime = atts.mime || ( atts.file && atts.file.type ) || '';
if ( _.isArray( type ) ) {
found = _.find( type, function (t) {
return -1 !== mime.indexOf( t );
} );
} else {
found = ! type || -1 !== mime.indexOf( type );
}
return found;
},
/**
* @static

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32914';
$wp_version = '4.3-alpha-32915';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.