修改获取分支

dev_forge
sylor_huang@126.com 5 years ago
parent 8859cde4e9
commit 536d53763f

@ -327,8 +327,8 @@ class ApplicationController < ActionController::Base
end
def current_user
# User.current
User.find_by_id 50207
User.current
# User.find_by_id 50207
# nil
end

@ -1,7 +1,7 @@
class IssuesController < ApplicationController
before_action :require_login, except: [:index, :show]
before_action :find_project
before_action :set_user
# 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]
before_action :set_issue, only: [:edit, :update, :destroy, :show, :copy, :close_issue, :lock_issue]
@ -127,10 +127,7 @@ class IssuesController < ApplicationController
def new
@all_branches = []
get_all_branches = Gitea::Repository::BranchesService.new(@project.owner, @project.repository.identifier).call
Rails.logger.info("######____________###########{@project.owner.login}")
Rails.logger.info("######____________###########{@user.login}")
Rails.logger.info("######_____@project.repository.identifier_______###########{@project.repository.identifier}")
get_all_branches = Gitea::Repository::BranchesService.new(@user, @project&.repository.try(:identifier)).call
if get_all_branches && get_all_branches.size > 0
get_all_branches.each do |b|
@all_branches.push(b["name"])
@ -345,8 +342,10 @@ class IssuesController < ApplicationController
end
private
def set_user
@user = @project.owner
def set_project_and_user
@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 @user.present?
end

Loading…
Cancel
Save