From 657b1f36d5864609652406356eef6ccfcad2ea3b Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Wed, 22 Apr 2020 14:28:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9commits=E7=9A=84=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/commits.json.jbuilder | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/views/repositories/commits.json.jbuilder b/app/views/repositories/commits.json.jbuilder index dff10128c..7bee6fd18 100644 --- a/app/views/repositories/commits.json.jbuilder +++ b/app/views/repositories/commits.json.jbuilder @@ -1,10 +1,13 @@ -json.total_count @hash_commit[:total_count] -json.commits do - json.array! @hash_commit[:body] do |commit| - json.sha commit['sha'] - json.message commit['commit']['message'] - json.timestamp render_unix_time(commit['commit']['author']['date']) - json.time_from_now time_from_now(commit['commit']['author']['date']) - json.partial! 'author', user: @project.owner +unless @hash_commit[:status].present? #如果有状态值,则表示报错了 + json.total_count @hash_commit[:total_count] + json.commits do + json.array! @hash_commit[:body] do |commit| + json.sha commit['sha'] + json.message commit['commit']['message'] + json.timestamp render_unix_time(commit['commit']['author']['date']) + json.time_from_now time_from_now(commit['commit']['author']['date']) + json.partial! 'author', user: @project.owner + end end end +