From 49e2b35a1e66efefb99b4e68d8f70bb83408b911 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 14 Nov 2024 15:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E4=BC=98=E5=8C=96co?= =?UTF-8?q?mmit=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- app/services/gitea/repository/commits/list_service.rb | 2 +- app/views/repositories/commit.json.jbuilder | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index b7776bcfd..c8b8a54f8 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -151,7 +151,7 @@ class RepositoriesController < ApplicationController return render_error('暂未开放,敬请期待.') else @commit = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, @owner&.gitea_token) - @commit_diff = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, @owner&.gitea_token, {diff: true}) + # @commit_diff = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, @owner&.gitea_token, {diff: true}) render_error(@commit[:message], @commit[:status]) if @commit.has_key?(:status) || @commit_diff.has_key?(:status) end end diff --git a/app/services/gitea/repository/commits/list_service.rb b/app/services/gitea/repository/commits/list_service.rb index 700508539..c4bd89b15 100644 --- a/app/services/gitea/repository/commits/list_service.rb +++ b/app/services/gitea/repository/commits/list_service.rb @@ -19,7 +19,7 @@ class Gitea::Repository::Commits::ListService < Gitea::ClientService private def params - { sha: args[:sha] || 'master', page: args[:page] || PAGINATE_DEFAULT_PAGE, limit: args[:limit] || PAGINATE_DEFAULT_LIMIT, token: args[:token] || "", stat: args[:page].to_i != 1 && args[:limit] !=1 } + { sha: args[:sha] || 'master', page: args[:page] || PAGINATE_DEFAULT_PAGE, limit: args[:limit] || PAGINATE_DEFAULT_LIMIT, token: args[:token] || "", stat: args[:page].to_i != 1 && args[:limit] !=1, files: false } end def url diff --git a/app/views/repositories/commit.json.jbuilder b/app/views/repositories/commit.json.jbuilder index 4c1074c8b..066bfb2d4 100644 --- a/app/views/repositories/commit.json.jbuilder +++ b/app/views/repositories/commit.json.jbuilder @@ -3,10 +3,10 @@ if @commit.blank? #如果有状态值,则表示报错了 json.total_count 0 json.commits [] else - json.files_count @commit_diff['NumFiles'] - json.total_addition @commit_diff['TotalAddition'] - json.total_deletion @commit_diff['TotalDeletion'] - json.files @commit_diff['Files'], partial: 'pull_requests/diff_file', as: :file, locals: {sha: @sha} + # json.files_count @commit_diff['NumFiles'] + # json.total_addition @commit_diff['TotalAddition'] + # json.total_deletion @commit_diff['TotalDeletion'] + # json.files @commit_diff['Files'], partial: 'pull_requests/diff_file', as: :file, locals: {sha: @sha} json.partial! 'commit', commit: @commit, project: @project json.parents @commit['parents'] do |parent|