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