From ccb9b5f8816d721ac3edfb56db9be7319fdbac1b Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 18 Nov 2024 15:23:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20pr=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=BC=A9=E5=B0=8F=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/api/pull_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/api/pull_helper.rb b/app/controllers/concerns/api/pull_helper.rb index e186cd6f2..ab72a0080 100644 --- a/app/controllers/concerns/api/pull_helper.rb +++ b/app/controllers/concerns/api/pull_helper.rb @@ -3,7 +3,7 @@ module Api::PullHelper def load_pull_request pull_request_id = params[:pull_id] || params[:id] - @pull_request = @project.pull_requests.where(gitea_number: pull_request_id).where.not(id: pull_request_id).take || PullRequest.find_by_id(pull_request_id) + @pull_request = @project.pull_requests.where(gitea_number: pull_request_id).where.not(id: pull_request_id).take || @project.pull_requests.find_by_id(pull_request_id) @issue = @pull_request&.issue if @pull_request logger.info "###########pull_request founded" From de2ee51fc4794c6b3e371ff6097d8380950bba1b Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 18 Nov 2024 17:10:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9:=20compare=20files?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/projects/compare_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/projects/compare_controller.rb b/app/controllers/api/v1/projects/compare_controller.rb index 2593399d1..8a40ba519 100644 --- a/app/controllers/api/v1/projects/compare_controller.rb +++ b/app/controllers/api/v1/projects/compare_controller.rb @@ -20,9 +20,9 @@ class Api::V1::Projects::CompareController < Api::V1::BaseController def gitea_compare_files(base, head) if params[:filepath].present? - $gitea_hat_client.get_repos_compare_files_by_owner_repo_baseref_headref_filepath(@project&.owner&.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), CGI.escape(params[:filepath]), {query: {token: current_user&.gitea_token}}) + $gitea_hat_client.get_repos_compare_by_owner_repo_baseref_headref(@project&.owner&.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), {query: {token: current_user&.gitea_token, isFiles: true, filepath: params[:filepath]}}) else - $gitea_hat_client.get_repos_compare_files_by_owner_repo_baseref_headref(@project&.owner&.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), {query: {page:page,limit:limit,token: current_user&.gitea_token}}) + $gitea_hat_client.get_repos_compare_by_owner_repo_baseref_headref(@project&.owner&.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), {query: {page:page,limit:limit,token: current_user&.gitea_token, isFiles: true}}) end end