mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-16 17:55:56 +08:00
新增:更改默认分支接口
This commit is contained in:
@@ -15,6 +15,17 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
|
||||
@result_object = Api::V1::Projects::Branches::CreateService.call(@project, branch_params, current_user&.gitea_token)
|
||||
end
|
||||
|
||||
before_action :require_manager_above, only: [:update_default_branch]
|
||||
|
||||
def update_default_branch
|
||||
@result_object = Api::V1::Projects::Branches::UpdateDefaultBranchService.call(@project, params[:default_branch], current_user&.gitea_token)
|
||||
if @result_object
|
||||
return render_ok
|
||||
else
|
||||
return render_error('更新默认分支失败!')
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def branch_params
|
||||
params.require(:branch).permit(:new_branch_name, :old_branch_name)
|
||||
|
||||
Reference in New Issue
Block a user