mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
修改commits的错误提示
This commit is contained in:
@@ -38,9 +38,7 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def commits
|
||||
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
|
||||
@hash_commit = Gitea::Repository::Commits::ListService.new(@project.owner, @project.identifier, sha: params[:sha], page: params[:page]).call
|
||||
end
|
||||
|
||||
def single_commit
|
||||
|
||||
@@ -24,9 +24,7 @@ class Gitea::Repository::Commits::ListService < Gitea::ClientService
|
||||
end
|
||||
|
||||
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
|
||||
when 200
|
||||
result = {}
|
||||
@@ -35,7 +33,8 @@ class Gitea::Repository::Commits::ListService < Gitea::ClientService
|
||||
total_count = headers["x-total"]
|
||||
result.merge(total_count: total_count.to_i, body: body)
|
||||
else
|
||||
{status: -1, message: "#{body['message']}"}
|
||||
nil
|
||||
# {status: -1, message: "#{body['message']}"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
Rails.logger.info("#######_______@hash_commit______############{@hash_commit}")
|
||||
if @hash_commit[:status].present? #如果有状态值,则表示报错了
|
||||
if @hash_commit.blank? #如果有状态值,则表示报错了
|
||||
json.total_count 0
|
||||
json.commits []
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user