Commit c7cb7599 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge pull request #5022 from amacarthur/config-public-project

make public/private setting for project creation configurable
parents 3811e434 cc1eb965
......@@ -16,7 +16,8 @@ def execute
wiki_enabled: default_features.wiki,
wall_enabled: default_features.wall,
snippets_enabled: default_features.snippets,
merge_requests_enabled: default_features.merge_requests
merge_requests_enabled: default_features.merge_requests,
public: default_features.public
}
@project = Project.new(default_opts.merge(params))
......
......@@ -2,8 +2,12 @@
.project-edit-errors
= render 'projects/errors'
.project-edit-content
%p.slead
New projects are private by default. You choose who can see the project and commit to repository.
- if Gitlab.config.gitlab.default_projects_features.public
%p.slead
New projects are public by default. Any signed in user can see your project but cannot commit to it unless granted access.
- else
%p.slead
New projects are private by default. You choose who can see the project and commit to repository.
%hr
= form_for @project, remote: true do |f|
.control-group.project-name-holder
......
......@@ -58,6 +58,7 @@ production: &base
wiki: true
wall: false
snippets: false
public: false
## External issues trackers
issues_tracker:
......
......@@ -75,6 +75,7 @@ def build_gitlab_url
Settings.gitlab.default_projects_features['wiki'] = true if Settings.gitlab.default_projects_features['wiki'].nil?
Settings.gitlab.default_projects_features['wall'] = false if Settings.gitlab.default_projects_features['wall'].nil?
Settings.gitlab.default_projects_features['snippets'] = false if Settings.gitlab.default_projects_features['snippets'].nil?
Settings.gitlab.default_projects_features['public'] = false if Settings.gitlab.default_projects_features['public'].nil?
#
# Gravatar
......
......@@ -30,6 +30,37 @@
it { @project.owner.should == @user }
it { @project.namespace.should == @group }
end
context 'respect configured public setting' do
before(:each) do
@settings = double("settings")
@settings.stub(:issues) { true }
@settings.stub(:merge_requests) { true }
@settings.stub(:wiki) { true }
@settings.stub(:wall) { true }
@settings.stub(:snippets) { true }
stub_const("Settings", Class.new)
Settings.stub_chain(:gitlab, :default_projects_features).and_return(@settings)
end
context 'should be public when setting is public' do
before do
@settings.stub(:public) { true }
@project = create_project(@user, @opts)
end
it { @project.public.should be_true }
end
context 'should be private when setting is not public' do
before do
@settings.stub(:public) { false }
@project = create_project(@user, @opts)
end
it { @project.public.should be_false }
end
end
end
def create_project(user, opts)
......
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