Commit f87e2d28 authored by Angus MacArthur's avatar Angus MacArthur

make public/private setting for project creation configurable

parent 9ad5d9a4
...@@ -16,7 +16,8 @@ module Projects ...@@ -16,7 +16,8 @@ module Projects
wiki_enabled: default_features.wiki, wiki_enabled: default_features.wiki,
wall_enabled: default_features.wall, wall_enabled: default_features.wall,
snippets_enabled: default_features.snippets, 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)) @project = Project.new(default_opts.merge(params))
......
...@@ -58,6 +58,7 @@ production: &base ...@@ -58,6 +58,7 @@ production: &base
wiki: true wiki: true
wall: false wall: false
snippets: false snippets: false
public: false
## External issues trackers ## External issues trackers
issues_tracker: issues_tracker:
......
...@@ -75,6 +75,7 @@ Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.g ...@@ -75,6 +75,7 @@ Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.g
Settings.gitlab.default_projects_features['wiki'] = true if Settings.gitlab.default_projects_features['wiki'].nil? 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['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['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 # Gravatar
......
...@@ -30,6 +30,34 @@ describe Projects::CreateContext do ...@@ -30,6 +30,34 @@ describe Projects::CreateContext do
it { @project.owner.should == @user } it { @project.owner.should == @user }
it { @project.namespace.should == @group } it { @project.namespace.should == @group }
end 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 end
def create_project(user, opts) 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