Commit 05329d4a authored by Sean McGivern's avatar Sean McGivern

Merge branch 'ee-2950-fix-namespace-visibility-level-helpers' into 'master'

Promote visibility level helpers from Group to Namespace

Closes gitlab-ee#2950

See merge request !12910
parents 1bd140ca c9e6caae
...@@ -2,7 +2,6 @@ require 'carrierwave/orm/activerecord' ...@@ -2,7 +2,6 @@ require 'carrierwave/orm/activerecord'
class Group < Namespace class Group < Namespace
include Gitlab::ConfigHelper include Gitlab::ConfigHelper
include Gitlab::VisibilityLevel
include AccessRequestable include AccessRequestable
include Avatarable include Avatarable
include Referable include Referable
...@@ -103,10 +102,6 @@ class Group < Namespace ...@@ -103,10 +102,6 @@ class Group < Namespace
full_name full_name
end end
def visibility_level_field
:visibility_level
end
def visibility_level_allowed_by_projects def visibility_level_allowed_by_projects
allowed_by_projects = self.projects.where('visibility_level > ?', self.visibility_level).none? allowed_by_projects = self.projects.where('visibility_level > ?', self.visibility_level).none?
......
...@@ -5,6 +5,7 @@ class Namespace < ActiveRecord::Base ...@@ -5,6 +5,7 @@ class Namespace < ActiveRecord::Base
include Sortable include Sortable
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
include Gitlab::CurrentSettings include Gitlab::CurrentSettings
include Gitlab::VisibilityLevel
include Routable include Routable
include AfterCommitQueue include AfterCommitQueue
...@@ -105,6 +106,10 @@ class Namespace < ActiveRecord::Base ...@@ -105,6 +106,10 @@ class Namespace < ActiveRecord::Base
end end
end end
def visibility_level_field
:visibility_level
end
def to_param def to_param
full_path full_path
end end
......
...@@ -63,6 +63,14 @@ describe Namespace, models: true do ...@@ -63,6 +63,14 @@ describe Namespace, models: true do
it { is_expected.to respond_to(:has_parent?) } it { is_expected.to respond_to(:has_parent?) }
end 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 describe '#to_param' do
it { expect(namespace.to_param).to eq(namespace.full_path) } it { expect(namespace.to_param).to eq(namespace.full_path) }
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