WebDAV folder listing optimization

This commit is contained in:
Karel Picman 2016-02-08 09:49:55 +01:00
parent 8955ac1b37
commit 51f355b861
3 changed files with 6 additions and 5 deletions

View File

@ -49,10 +49,10 @@ module RedmineDmsf
unless @childern
@children = []
if collection?
folder.subfolders.visible.map do |p|
folder.subfolders.select(:title).visible.map do |p|
@children.push child(p.title)
end
folder.files.visible.map do |p|
folder.files.select(:name).visible.map do |p|
@children.push child(p.name)
end
end

View File

@ -26,7 +26,8 @@ module RedmineDmsf
def children
unless @projects
@projects = []
Project.has_module(:dmsf).where(Project.allowed_to_condition(
Project.select(:identifier).has_module(:dmsf).where(
Project.allowed_to_condition(
User.current, :view_dmsf_folders)).order('lft').all.each do |p|
@projects << child(p.identifier)
end

View File

@ -27,10 +27,10 @@ module RedmineDmsf
unless @children
@children = []
if project
project.dmsf_folders.visible.map do |p|
project.dmsf_folders.select(:title).visible.map do |p|
@children.push child(p.title)
end
project.dmsf_files.visible.map do |p|
project.dmsf_files.select(:name).visible.map do |p|
@children.push child(p.name)
end
end