summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'app/services')
-rw-r--r--app/services/projects/update_service.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb
index 67e3429c0bd..cd7a8b18218 100644
--- a/app/services/projects/update_service.rb
+++ b/app/services/projects/update_service.rb
@@ -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