issue的问题修复及pull_request的问题修复

dev_forge
sylor_huang@126.com 5 years ago
parent ded4281470
commit 57415df2aa

@ -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

@ -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

Loading…
Cancel
Save