Commit 37edce19 authored by Mike Greiling's avatar Mike Greiling
Browse files

recognize instances where group visibility levels are unavailable

parent 9715698e830a
......@@ -96,6 +96,7 @@ def restricted_visibility_levels(show_all = false)
to: :current_application_settings
def skip_level?(form_model, level)
form_model.is_a?(Project) && !form_model.visibility_level_allowed?(level)
return false unless form_model.respond_to?(:visibility_level_allowed?)
!form_model.visibility_level_allowed?(level)
end
end
......@@ -136,6 +136,12 @@ def visibility_level_allowed_by_sub_groups?(level = self.visibility_level)
children.where('visibility_level > ?', level).none?
end
def visibility_level_allowed?(level = self.visibility_level)
visibility_level_allowed_by_parent?(level) &&
visibility_level_allowed_by_projects?(level) &&
visibility_level_allowed_by_sub_groups?(level)
end
def avatar_url(**args)
# We use avatar_path instead of overriding avatar_url because of carrierwave.
# See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11001/diffs#note_28659864
......
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