From 71ad6083dd18bcdeeece864d45bcd6619447b0ff Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Thu, 19 Mar 2020 15:27:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9project=E7=9A=84=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 8 +------- app/controllers/project_trends_controller.rb | 2 +- app/controllers/pull_requests_controller.rb | 2 +- app/controllers/version_releases_controller.rb | 2 +- app/controllers/versions_controller.rb | 2 +- 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index cc4e3dd..d4c6eee 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_issue + before_action :find_project_with_id 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] @@ -430,10 +430,4 @@ class IssuesController < ApplicationController end all_branches end - - def find_project_issue - project_id = params[:id] - @project = Project.find_by(id: project_id) - render_not_found("未找到’#{project}’相关的项目") unless @project - end end diff --git a/app/controllers/project_trends_controller.rb b/app/controllers/project_trends_controller.rb index 7bc6bbe..476a571 100644 --- a/app/controllers/project_trends_controller.rb +++ b/app/controllers/project_trends_controller.rb @@ -1,5 +1,5 @@ class ProjectTrendsController < ApplicationController - before_action :find_project + before_action :find_project_with_id before_action :check_project_public def index diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index c432296..ac18a71 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -1,6 +1,6 @@ class PullRequestsController < ApplicationController before_action :require_login - before_action :find_project + before_action :find_project_with_id before_action :set_repository before_action :find_pull_request, except: [:index, :new, :create, :check_can_merge] include TagChosenHelper diff --git a/app/controllers/version_releases_controller.rb b/app/controllers/version_releases_controller.rb index 541c30d..96be489 100644 --- a/app/controllers/version_releases_controller.rb +++ b/app/controllers/version_releases_controller.rb @@ -1,5 +1,5 @@ class VersionReleasesController < ApplicationController - before_action :find_project + before_action :find_project_with_id before_action :set_user_and_project before_action :require_login, except: [:index] before_action :find_version , only: [:edit, :update, :destroy] diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index ccabd13..77d7668 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -1,6 +1,6 @@ class VersionsController < ApplicationController before_action :require_login - before_action :find_project + before_action :find_project_with_id before_action :check_issue_permission, except: [:show, :index] before_action :set_version, only: [:edit, :update, :destroy, :show,:update_status]