forked from Gitlink/forgeplus
Update repository with default branch params
This commit is contained in:
parent
a54613752e
commit
558abb71bb
|
@ -676,6 +676,7 @@ http://localhost:3000/api/projects/3263.json | jq
|
|||
|description |否|string |项目描述 |
|
||||
|project_category_id|否|int |项目类别id |
|
||||
|project_language_id|否|int |项目语言id |
|
||||
|default_branch |否|string |默认分支名称 |
|
||||
|private |否|boolean|项目是否私有, true:为私有,false: 公开,默认为公开 |
|
||||
|
||||
|
||||
|
|
|
@ -71,9 +71,13 @@ class ProjectsController < ApplicationController
|
|||
ActiveRecord::Base.transaction do
|
||||
# Projects::CreateForm.new(project_params).validate!
|
||||
private = params[:private]
|
||||
gitea_params = {
|
||||
private: private,
|
||||
default_branch: params[:default_branch]
|
||||
}
|
||||
if [true, false].include? private
|
||||
new_project_params = project_params.merge(is_public: !private)
|
||||
Gitea::Repository::UpdateService.new(@project.owner, @project.repository.identifier, {private: private}).call
|
||||
Gitea::Repository::UpdateService.call(@owner, @project.identifier, gitea_params)
|
||||
@project.repository.update_column(:hidden, private)
|
||||
end
|
||||
@project.update_attributes!(new_project_params)
|
||||
|
|
|
@ -28,6 +28,6 @@ class Gitea::Repository::UpdateService < Gitea::ClientService
|
|||
end
|
||||
|
||||
def data_params
|
||||
Hash.new.merge(token: user.gitea_token, data: params)
|
||||
Hash.new.merge(token: user.gitea_token, data: params).compact
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue