Commit d2846293 authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Move visibility_level check for forked projects to Project model

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