BigW Consortium Gitlab

Commit 7f866272 by Sean McGivern Committed by Mike Greiling

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
parent 65832102
......@@ -2,7 +2,6 @@ require 'carrierwave/orm/activerecord'
class Group < Namespace
include Gitlab::ConfigHelper
include Gitlab::VisibilityLevel
include AccessRequestable
include Avatarable
include Referable
......@@ -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?
......
......@@ -5,6 +5,7 @@ class Namespace < ActiveRecord::Base
include Sortable
include Gitlab::ShellAdapter
include Gitlab::CurrentSettings
include Gitlab::VisibilityLevel
include Routable
include AfterCommitQueue
......@@ -105,6 +106,10 @@ class Namespace < ActiveRecord::Base
end
end
def visibility_level_field
:visibility_level
end
def to_param
full_path
end
......
......@@ -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
......
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