diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-07-14 20:12:52 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-07-14 20:12:52 +0300 |
commit | 394841364cd37deef99592fd83928413557b89ea (patch) | |
tree | b376b7e7437fb3edd60619b077a65ff36d8ed57b | |
parent | 26556a5c761b143b4049199cce348834f34333cd (diff) | |
parent | 3c0596974a930b25ba96e9fe4f11ddd606d7473f (diff) | |
download | gitlab-ce-394841364cd37deef99592fd83928413557b89ea.tar.gz |
Merge branch 'master' of github.com:gitlabhq/gitlabhq
-rw-r--r-- | doc/api/projects.md | 2 | ||||
-rw-r--r-- | doc/update/5.4-to-6.0.md | 2 | ||||
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/projects.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 30 |
5 files changed, 40 insertions, 4 deletions
diff --git a/doc/api/projects.md b/doc/api/projects.md index b3e4ec0214e..2fc235066df 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -189,6 +189,7 @@ Parameters: + `merge_requests_enabled` (optional) + `wiki_enabled` (optional) + `snippets_enabled` (optional) ++ `public` (optional) **Project access levels** @@ -221,6 +222,7 @@ Parameters: + `merge_requests_enabled` (optional) + `wiki_enabled` (optional) + `snippets_enabled` (optional) ++ `public` (optional) diff --git a/doc/update/5.4-to-6.0.md b/doc/update/5.4-to-6.0.md index d241b422c66..291737fa793 100644 --- a/doc/update/5.4-to-6.0.md +++ b/doc/update/5.4-to-6.0.md @@ -36,7 +36,7 @@ sudo -u git -H bundle install --without development test mysql --deployment sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production sudo -u git -H bundle exec rake migrate_groups RAILS_ENV=production sudo -u git -H bundle exec rake migrate_global_projects RAILS_ENV=production -sudo -u git -H bundle exec rake migrate_global_keys RAILS_ENV=production +sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production ``` diff --git a/lib/api/entities.rb b/lib/api/entities.rb index f31050b008d..c8531e80af1 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -36,7 +36,7 @@ module API expose :owner, using: Entities::UserBasic expose :name, :name_with_namespace expose :path, :path_with_namespace - expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :snippets_enabled, :created_at, :last_activity_at + expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :snippets_enabled, :created_at, :last_activity_at, :public expose :namespace expose :forked_from_project, using: Entities::ForkedFromProject, :if => lambda{ | project, options | project.forked? } end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index eb8a814be5d..1fdfff931a4 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -67,6 +67,7 @@ module API # wiki_enabled (optional) # snippets_enabled (optional) # namespace_id (optional) - defaults to user namespace + # public (optional) - false by default # Example Request # POST /projects post do @@ -79,7 +80,8 @@ module API :merge_requests_enabled, :wiki_enabled, :snippets_enabled, - :namespace_id] + :namespace_id, + :public] @project = ::Projects::CreateContext.new(current_user, attrs).execute if @project.saved? present @project, with: Entities::Project @@ -103,6 +105,7 @@ module API # merge_requests_enabled (optional) # wiki_enabled (optional) # snippets_enabled (optional) + # public (optional) # Example Request # POST /projects/user/:user_id post "user/:user_id" do @@ -115,7 +118,8 @@ module API :wall_enabled, :merge_requests_enabled, :wiki_enabled, - :snippets_enabled] + :snippets_enabled, + :public] @project = ::Projects::CreateContext.new(user, attrs).execute if @project.saved? present @project, with: Entities::Project diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 300bff28871..863ecc61bbb 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -104,6 +104,21 @@ describe API::API do json_response[k.to_s].should == v end end + + it "should set a project as public" do + project = attributes_for(:project, { public: true }) + post api("/projects", user), project + json_response['public'].should be_true + + end + + it "should set a project as private" do + project = attributes_for(:project, { public: false }) + post api("/projects", user), project + json_response['public'].should be_false + + end + end describe "POST /projects/user/:id" do @@ -144,6 +159,21 @@ describe API::API do json_response[k.to_s].should == v end end + + it "should set a project as public" do + project = attributes_for(:project, { public: true }) + post api("/projects/user/#{user.id}", admin), project + json_response['public'].should be_true + + end + + it "should set a project as private" do + project = attributes_for(:project, { public: false }) + post api("/projects/user/#{user.id}", admin), project + json_response['public'].should be_false + + end + end describe "GET /projects/:id" do |