mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
In wp.media.model.Attachments.filters.type(), return true earlier if type isn't set.
Props vivekbhusal. Fixes #32746. git-svn-id: https://develop.svn.wordpress.org/trunk@33091 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -897,14 +897,18 @@ var Attachments = Backbone.Collection.extend({
|
||||
type: function( attachment ) {
|
||||
var type = this.props.get('type'), atts = attachment.toJSON(), mime, found;
|
||||
|
||||
if ( ! type || ( _.isArray( type ) && ! type.length ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mime = atts.mime || ( atts.file && atts.file.type ) || '';
|
||||
|
||||
if ( _.isArray( type ) ) {
|
||||
found = ! type.length || _.find( type, function (t) {
|
||||
found = _.find( type, function (t) {
|
||||
return -1 !== mime.indexOf( t );
|
||||
} );
|
||||
} else {
|
||||
found = ! type || -1 !== mime.indexOf( type );
|
||||
found = -1 !== mime.indexOf( type );
|
||||
}
|
||||
|
||||
return found;
|
||||
|
||||
@@ -493,14 +493,18 @@ var Attachments = Backbone.Collection.extend({
|
||||
type: function( attachment ) {
|
||||
var type = this.props.get('type'), atts = attachment.toJSON(), mime, found;
|
||||
|
||||
if ( ! type || ( _.isArray( type ) && ! type.length ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mime = atts.mime || ( atts.file && atts.file.type ) || '';
|
||||
|
||||
if ( _.isArray( type ) ) {
|
||||
found = ! type.length || _.find( type, function (t) {
|
||||
found = _.find( type, function (t) {
|
||||
return -1 !== mime.indexOf( t );
|
||||
} );
|
||||
} else {
|
||||
found = ! type || -1 !== mime.indexOf( type );
|
||||
found = -1 !== mime.indexOf( type );
|
||||
}
|
||||
|
||||
return found;
|
||||
|
||||
Reference in New Issue
Block a user