Commit 0a21731e authored by Tomasz Maczukin's avatar Tomasz Maczukin

Add ci fields in project create/update feature API

parent f60bceb9
...@@ -157,7 +157,7 @@ module API ...@@ -157,7 +157,7 @@ module API
def attributes_for_keys(keys, custom_params = nil) def attributes_for_keys(keys, custom_params = nil)
attrs = {} attrs = {}
keys.each do |key| keys.each do |key|
if params[key].present? or (params.has_key?(key) and params[key] == false) if params[key].present? or (params.has_key?(key) and (params[key].empty? or params[key] == false))
attrs[key] = params[key] attrs[key] = params[key]
end end
end end
......
...@@ -114,7 +114,10 @@ module API ...@@ -114,7 +114,10 @@ module API
:namespace_id, :namespace_id,
:public, :public,
:visibility_level, :visibility_level,
:import_url] :import_url,
:build_allow_git_fetch,
:build_timeout,
:build_coverage_regex]
attrs = map_public_to_visibility_level(attrs) attrs = map_public_to_visibility_level(attrs)
@project = ::Projects::CreateService.new(current_user, attrs).execute @project = ::Projects::CreateService.new(current_user, attrs).execute
if @project.saved? if @project.saved?
...@@ -159,7 +162,10 @@ module API ...@@ -159,7 +162,10 @@ module API
:shared_runners_enabled, :shared_runners_enabled,
:public, :public,
:visibility_level, :visibility_level,
:import_url] :import_url,
:build_allow_git_fetch,
:build_timeout,
:build_coverage_regex]
attrs = map_public_to_visibility_level(attrs) attrs = map_public_to_visibility_level(attrs)
@project = ::Projects::CreateService.new(user, attrs).execute @project = ::Projects::CreateService.new(user, attrs).execute
if @project.saved? if @project.saved?
...@@ -215,7 +221,10 @@ module API ...@@ -215,7 +221,10 @@ module API
:snippets_enabled, :snippets_enabled,
:shared_runners_enabled, :shared_runners_enabled,
:public, :public,
:visibility_level] :visibility_level,
:build_allow_git_fetch,
:build_timeout,
:build_coverage_regex]
attrs = map_public_to_visibility_level(attrs) attrs = map_public_to_visibility_level(attrs)
authorize_admin_project authorize_admin_project
authorize! :rename_project, user_project if attrs[:name].present? authorize! :rename_project, user_project if attrs[:name].present?
......
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