修改commits的错误提示
This commit is contained in:
parent
f9f5b9fdb7
commit
2738efb04d
|
@ -38,9 +38,7 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def commits
|
def commits
|
||||||
hash_commit = Gitea::Repository::Commits::ListService.new(@project.owner, @project.identifier, sha: params[:sha], page: params[:page]).call
|
@hash_commit = Gitea::Repository::Commits::ListService.new(@project.owner, @project.identifier, sha: params[:sha], page: params[:page]).call
|
||||||
Rails.logger.info("##########__________hash_commit__________########{hash_commit}")
|
|
||||||
@hash_commit = hash_commit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def single_commit
|
def single_commit
|
||||||
|
|
|
@ -24,9 +24,7 @@ class Gitea::Repository::Commits::ListService < Gitea::ClientService
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_result(response)
|
def render_result(response)
|
||||||
Rails.logger.info("#####___________response.status_________##########{response.status}")
|
|
||||||
Rails.logger.info("#####___________response.body_________##########{response.body}")
|
|
||||||
body = JSON.parse(response.body)
|
|
||||||
case response.status
|
case response.status
|
||||||
when 200
|
when 200
|
||||||
result = {}
|
result = {}
|
||||||
|
@ -35,7 +33,8 @@ class Gitea::Repository::Commits::ListService < Gitea::ClientService
|
||||||
total_count = headers["x-total"]
|
total_count = headers["x-total"]
|
||||||
result.merge(total_count: total_count.to_i, body: body)
|
result.merge(total_count: total_count.to_i, body: body)
|
||||||
else
|
else
|
||||||
{status: -1, message: "#{body['message']}"}
|
nil
|
||||||
|
# {status: -1, message: "#{body['message']}"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
Rails.logger.info("#######_______@hash_commit______############{@hash_commit}")
|
if @hash_commit.blank? #如果有状态值,则表示报错了
|
||||||
if @hash_commit[:status].present? #如果有状态值,则表示报错了
|
|
||||||
json.total_count 0
|
json.total_count 0
|
||||||
json.commits []
|
json.commits []
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue