Commit d2846293 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Move visibility_level check for forked projects to Project model

parent 77ef4855
...@@ -89,7 +89,6 @@ module VisibilityLevelHelper ...@@ -89,7 +89,6 @@ module VisibilityLevelHelper
def skip_level?(form_model, level) def skip_level?(form_model, level)
form_model.is_a?(Project) && form_model.is_a?(Project) &&
form_model.forked? && !form_model.visibility_level_allowed?(level)
!Gitlab::VisibilityLevel.allowed_fork_levels(form_model.forked_from_project.visibility_level).include?(level)
end end
end end
...@@ -783,4 +783,9 @@ class Project < ActiveRecord::Base ...@@ -783,4 +783,9 @@ class Project < ActiveRecord::Base
service.active = true service.active = true
service.save service.save
end end
def visibility_level_allowed?(level)
return true unless forked?
Gitlab::VisibilityLevel.allowed_fork_levels(forked_from_project.visibility_level).include?(level)
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