修复:分支返回更改为数组

This commit is contained in:
yystopf 2023-03-31 10:31:10 +08:00
parent c78badf091
commit 53458dab8f
2 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,7 @@ class ProjectsController < ApplicationController
# result = Gitea::Repository::Branches::ListService.call(@owner, @project.identifier)
result = Gitea::Repository::Branches::ListNameService.call(@owner, @project.identifier, params[:name])
@branches = result.is_a?(Hash) ? (result.key?(:status) ? [] : result["branch_name"]) : result
@branches = result.is_a?(Hash) ? (result.key?(:status) ? [] : result) : result
end
def branches_slice

View File

@ -12,7 +12,7 @@ class Traces::ProjectsController < Traces::BaseController
return render_error("无可用检测次数") if @project.user_trace_tasks.size >= 5
return render_error("分支名不能为空!") if branch_name.blank?
@all_branches = Gitea::Repository::Branches::ListNameService.call(@project&.owner, @project.identifier)
return render_error("请输入正确的分支名!") unless @all_branches["branch_name"].include?(branch_name)
return render_error("请输入正确的分支名!") unless @all_branches.include?(branch_name)
code, data, error = Trace::CheckService.call(current_user.trace_token, @project, "1", branch_name)
if code == 200
UserTraceTask.create!(
@ -51,7 +51,7 @@ class Traces::ProjectsController < Traces::BaseController
branch_name = params[:branch_name]
return render_error("分支名不能为空!") if branch_name.blank?
@all_branches = Gitea::Repository::Branches::ListNameService.call(@project&.owner, @project.identifier)
return render_error("请输入正确的分支名!") unless @all_branches["branch_name"].include?(branch_name)
return render_error("请输入正确的分支名!") unless @all_branches.include?(branch_name)
code, data, error = Trace::ReloadCheckService.call(current_user.trace_token, params[:project_id])
if code == 200
UserTraceTask.create!(