From f5db3273cd1c5739cbdc556d3796890bf839f251 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 27 Mar 2023 13:55:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E6=95=B0=E6=8D=AE=E4=BD=BF=E7=94=A8=E6=8B=A5?= =?UTF-8?q?=E6=9C=89=E8=80=85token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index d5e25989..f03215ac 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -122,10 +122,10 @@ class RepositoriesController < ApplicationController if params[:filepath].present? file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip)) @hash_commit = Gitea::Repository::Commits::FileListService.new(@owner.login, @project.identifier, file_path_uri, - sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call + sha: params[:sha], page: params[:page], limit: params[:limit], token: @owner&.gitea_token).call else @hash_commit = Gitea::Repository::Commits::ListService.new(@owner.login, @project.identifier, - sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call + sha: params[:sha], page: params[:page], limit: params[:limit], token: @owner&.gitea_token).call end end end @@ -140,8 +140,8 @@ class RepositoriesController < ApplicationController if @project.educoder? return render_error('暂未开放,敬请期待.') else - @commit = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, current_user&.gitea_token) - @commit_diff = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, current_user&.gitea_token, {diff: true}) + @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}) render_error(@commit[:message], @commit[:status]) if @commit.has_key?(:status) || @commit_diff.has_key?(:status) end end @@ -156,7 +156,7 @@ class RepositoriesController < ApplicationController @tag_names = result.is_a?(Hash) && result.key?(:status) ? [] : name_result - result = Gitea::Repository::Tags::ListService.call(current_user&.gitea_token, @owner.login, @project.identifier, {page: params[:page], limit: params[:limit]}) + result = Gitea::Repository::Tags::ListService.call(@owner&.gitea_token, @owner.login, @project.identifier, {page: params[:page], limit: params[:limit]}) @tags = result.is_a?(Hash) && result.key?(:status) ? [] : result end