Commit 945e4293 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Prevent unnecessary forks iteration at parent update

parent 6f41e3d9
...@@ -13,7 +13,7 @@ module Projects ...@@ -13,7 +13,7 @@ module Projects
end end
return false unless visibility_level_allowed?(new_visibility) return false unless visibility_level_allowed?(new_visibility)
update_forks_visibility_level(new_visibility) update_forks_visibility_level(new_visibility.to_i)
end end
new_branch = params[:default_branch] new_branch = params[:default_branch]
...@@ -44,11 +44,13 @@ module Projects ...@@ -44,11 +44,13 @@ module Projects
end end
def update_forks_visibility_level(new_level) def update_forks_visibility_level(new_level)
return unless new_level < project.visibility_level
project.forks.each do |forked_project| project.forks.each do |forked_project|
fork_level = forked_project.visibility_level fork_level = forked_project.visibility_level
if fork_level > new_level.to_i if fork_level > new_level
forked_project.visibility_level = new_level.to_i forked_project.visibility_level = new_level
forked_project.save! forked_project.save!
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment