Skip to content
Snippets Groups Projects
Commit c9e6caae authored by Nick Thomas's avatar Nick Thomas
Browse files

Promote visibility level helpers from Group to Namespace

In EE, we make use of `namespace#public?` in projects. When the project is in a
personal namespace, this breaks as the `public?` helper isn't present.
parent 5f32bd77
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,7 +2,6 @@ require 'carrierwave/orm/activerecord'
 
class Group < Namespace
include Gitlab::ConfigHelper
include Gitlab::VisibilityLevel
include AccessRequestable
include Avatarable
include Referable
Loading
Loading
@@ -103,10 +102,6 @@ class Group < Namespace
full_name
end
 
def visibility_level_field
:visibility_level
end
def visibility_level_allowed_by_projects
allowed_by_projects = self.projects.where('visibility_level > ?', self.visibility_level).none?
 
Loading
Loading
Loading
Loading
@@ -5,6 +5,7 @@ class Namespace < ActiveRecord::Base
include Sortable
include Gitlab::ShellAdapter
include Gitlab::CurrentSettings
include Gitlab::VisibilityLevel
include Routable
include AfterCommitQueue
 
Loading
Loading
@@ -105,6 +106,10 @@ class Namespace < ActiveRecord::Base
end
end
 
def visibility_level_field
:visibility_level
end
def to_param
full_path
end
Loading
Loading
Loading
Loading
@@ -63,6 +63,14 @@ describe Namespace, models: true do
it { is_expected.to respond_to(:has_parent?) }
end
 
describe 'inclusions' do
it { is_expected.to include_module(Gitlab::VisibilityLevel) }
end
describe '#visibility_level_field' do
it { expect(namespace.visibility_level_field).to eq(:visibility_level) }
end
describe '#to_param' do
it { expect(namespace.to_param).to eq(namespace.full_path) }
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment