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
This commit is contained in:
commit
05329d4a36
3 changed files with 13 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue