Fix default visibility_level for new projects
This commit is contained in:
parent
7a10ef6e75
commit
00a3b466e7
|
@ -73,7 +73,7 @@ class Project < ActiveRecord::Base
|
|||
delegate :no_import?, to: :import_state, allow_nil: true
|
||||
|
||||
default_value_for :archived, false
|
||||
default_value_for :visibility_level, gitlab_config_features.visibility_level
|
||||
default_value_for(:visibility_level) { Gitlab::CurrentSettings.default_project_visibility }
|
||||
default_value_for :resolve_outdated_diff_discussions, false
|
||||
default_value_for :container_registry_enabled, gitlab_config_features.container_registry
|
||||
default_value_for(:repository_storage) { Gitlab::CurrentSettings.pick_repository_storage }
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix default visibility_level for new projects
|
||||
merge_request: 24120
|
||||
author: Fabian Schneider @fabsrc
|
||||
type: fixed
|
|
@ -1413,6 +1413,24 @@ describe Project do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#visibility_level' do
|
||||
let(:project) { build(:project) }
|
||||
|
||||
subject { project.visibility_level }
|
||||
|
||||
context 'by default' do
|
||||
it { is_expected.to eq(Gitlab::VisibilityLevel::PRIVATE) }
|
||||
end
|
||||
|
||||
context 'when set to INTERNAL in application settings' do
|
||||
before do
|
||||
stub_application_setting(default_project_visibility: Gitlab::VisibilityLevel::INTERNAL)
|
||||
end
|
||||
|
||||
it { is_expected.to eq(Gitlab::VisibilityLevel::INTERNAL) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#visibility_level_allowed?' do
|
||||
let(:project) { create(:project, :internal) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue