mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-23 07:13:57 +08:00
Fix issue loading navigator [SCI-10513]
This commit is contained in:
parent
0746519fcb
commit
8b0a2d51b5
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue