Prevent unnecessary forks iteration at parent update
This commit is contained in:
parent
6f41e3d9ca
commit
945e4293cb
1 changed files with 5 additions and 3 deletions
|
@ -13,7 +13,7 @@ module Projects
|
|||
end
|
||||
|
||||
return false unless visibility_level_allowed?(new_visibility)
|
||||
update_forks_visibility_level(new_visibility)
|
||||
update_forks_visibility_level(new_visibility.to_i)
|
||||
end
|
||||
|
||||
new_branch = params[:default_branch]
|
||||
|
@ -44,11 +44,13 @@ module Projects
|
|||
end
|
||||
|
||||
def update_forks_visibility_level(new_level)
|
||||
return unless new_level < project.visibility_level
|
||||
|
||||
project.forks.each do |forked_project|
|
||||
fork_level = forked_project.visibility_level
|
||||
|
||||
if fork_level > new_level.to_i
|
||||
forked_project.visibility_level = new_level.to_i
|
||||
if fork_level > new_level
|
||||
forked_project.visibility_level = new_level
|
||||
forked_project.save!
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue