From 57415df2aa48aebc0b29a3d4725a06dcdb63d742 Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Wed, 19 Feb 2020 19:11:50 +0800 Subject: [PATCH] =?UTF-8?q?issue=E7=9A=84=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=8F=8Apull=5Frequest=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 6 +++--- app/controllers/pull_requests_controller.rb | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 4884a3c33..68a71264a 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -1,6 +1,6 @@ class IssuesController < ApplicationController before_action :require_login, except: [:index, :show] - # before_action :find_project + before_action :find_project before_action :set_project_and_user before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen, :close_issue] before_action :check_issue_permission, except: [:index, :show, :index_chosen] @@ -350,9 +350,9 @@ class IssuesController < ApplicationController private def set_project_and_user - @project = Project.find_by_identifier(params[:project_id]) || (Project.find params[:project_id]) || (Project.find params[:id]) + # @project = Project.find_by_identifier(params[:project_id]) || (Project.find params[:project_id]) || (Project.find params[:id]) @user = @project&.owner - normal_status(-1, "项目不存在") unless @project.present? + # normal_status(-1, "项目不存在") unless @project.present? normal_status(-1, "用户不存在") unless @user.present? end diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 83b52c8d7..1d8f8a08e 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -1,6 +1,7 @@ class PullRequestsController < ApplicationController before_action :require_login - before_action :set_project + before_action :find_project + before_action :set_repository before_action :find_pull_request, except: [:index, :new, :create] include TagChosenHelper include ApplicationHelper @@ -342,11 +343,11 @@ class PullRequestsController < ApplicationController private - def set_project - @project = Project.find_by_identifier! params[:id] + def set_repository + # @project = Project.find_by_identifier! params[:id] @repository = @project.repository @user = @project.owner - normal_status(-1, "项目不存在") unless @project.present? + # normal_status(-1, "项目不存在") unless @project.present? normal_status(-1, "仓库不存在") unless @repository.present? normal_status(-1, "用户不存在") unless @user.present? end