Merge pull request #7352 from wandji20/wb-SCI-10513

Fix issue loading navigator [SCI-10513]
This commit is contained in:
aignatov-bio 2024-03-25 10:17:39 +01:00 committed by GitHub
commit b8a69f2d18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,7 +24,7 @@ module Navigator
url: project_folder_path(folder, view_mode: archived ? 'archived' : 'active'),
archived: folder.archived,
type: :folder,
has_children: folder.has_children,
has_children: folder.try(:has_children),
children_url: navigator_project_folder_path(folder)
}
end
@ -180,6 +180,8 @@ module Navigator
archived = params[:archived] == 'true'
tree = fetch_projects(folder.parent_folder, archived).map { |i| project_serializer(i, archived) } +
fetch_project_folders(folder.parent_folder, archived).map { |i| folder_serializer(i, archived) }
# Tree will not contain folder when folder archived state and params archived values are contradictory
tree.find { |i| i[:id] == folder.code } || (tree << folder_serializer(folder, archived))
tree.find { |i| i[:id] == folder.code }[:children] = children
tree = build_folder_tree(folder.parent_folder, tree) if folder.parent_folder.present?
tree