Skip to content

Commit

Permalink
Ensuring the hidden folders filter takes folders with NULL for their …
Browse files Browse the repository at this point in the history
…hidden field into account
  • Loading branch information
DominicWatson committed Jan 30, 2015
1 parent d1573bb commit 8ebc8f6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions system/services/assetManager/AssetManagerService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ component singleton=true output=false {

public query function getFolder( required string id, boolean includeHidden=false ) output=false {
var filter = { id=arguments.id };
var extra = [];
if ( !includeHidden ) {
filter.hidden = false;
extra.append( _getExcludeHiddenFilter() );
}

return _getFolderDao().selectData( filter=filter );
return _getFolderDao().selectData( filter=filter, extraFilters=extra );
}

public query function getFolderAncestors( required string id, boolean includeChildFolder=false ) output=false {
Expand Down Expand Up @@ -161,7 +162,8 @@ component singleton=true output=false {
var tree = [];
var folders = _getFolderDao().selectData(
selectFields = [ "id", "label", "access_restriction", "is_system_folder" ]
, filter = Len( Trim( arguments.parentFolder ) ) ? { parent_folder = arguments.parentFolder, hidden=false } : { id = getRootFolderId(), hidden=false }
, filter = Len( Trim( arguments.parentFolder ) ) ? { parent_folder = arguments.parentFolder } : { id = getRootFolderId() }
, extraFilters = [ _getExcludeHiddenFilter() ]
, orderBy = "label"
);

Expand Down Expand Up @@ -804,6 +806,10 @@ component singleton=true output=false {
return IsBoolean( setting ) && setting;
}

private struct function _getExcludeHiddenFilter() output=false {
return { filter="hidden is null or hidden = 0" }
}

// GETTERS AND SETTERS
private any function _getStorageProvider() output=false {
return _storageProvider;
Expand Down

0 comments on commit 8ebc8f6

Please sign in to comment.