Add an outer check to make sure the scope.includeSubFolders property is not undefined, which makes the media render in the view again

This commit is contained in:
Jan Skovgaard
2018-10-02 19:54:12 +02:00
committed by Sebastiaan Janssen
parent 125bbdd5bd
commit 0a245dda43

View File

@@ -125,13 +125,19 @@ Use this directive to generate a thumbnail grid of media items.
i--;
}
if (scope.includeSubFolders !== 'true') {
if (item.parentId !== parseInt(scope.currentFolderId)) {
scope.items.splice(i, 1);
i--;
// If subfolder search is not enabled remove the media items that's not needed
// Make sure that includeSubFolder is not undefined since the directive is used
// in contexts where it should not be used. Currently only used when we trigger
// a media picker
if(scope.includeSubFolders !== undefined){
if (scope.includeSubFolders !== 'true') {
if (item.parentId !== parseInt(scope.currentFolderId)) {
scope.items.splice(i, 1);
i--;
}
}
}
}
@@ -152,7 +158,7 @@ Use this directive to generate a thumbnail grid of media items.
}
if (!item.isFolder) {
// handle entity
if(item.image) {
item.thumbnail = mediaHelper.resolveFileFromEntity(item, true);
@@ -161,7 +167,7 @@ Use this directive to generate a thumbnail grid of media items.
} else {
item.thumbnail = mediaHelper.resolveFile(item, true);
item.image = mediaHelper.resolveFile(item, false);
var fileProp = _.find(item.properties, function (v) {
return (v.alias === "umbracoFile");
});