FIX ci certification bug

This commit is contained in:
Jasder 2020-09-11 09:55:21 +08:00
parent ad43c6975b
commit f3d6244fee
1 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ class Ci::CloudAccountsController < Ci::BaseController
end
def activate
return render_error('请先在指定地址做用户认证') unless @user.ci_certification?
return render_error('请先在指定地址做用户认证') unless current_user.ci_certification?
return render_error('该项目已经激活') if @repo && @repo.repo_active?
begin
@ -31,15 +31,15 @@ class Ci::CloudAccountsController < Ci::BaseController
ActiveRecord::Base.transaction do
if @repo
return render_error('该项目已经激活') if @repo.repo_active?
@repo.activate!(@user.user_id)
@repo.activate!(current_user.user_id)
else
@repo = Ci::Repo.auto_create!(@uesr, @project)
@repo = Ci::Repo.auto_create!(current_user, @project)
@user.update_column(:user_syncing, false)
end
result = bind_hook!(@user, @cloud_account, @repo)
result = bind_hook!(current_user, @cloud_account, @repo)
@project.update_columns(open_devops: true, gitea_webhook_id: result['id'])
@cloud_account.update_column(:ci_user_id, @user.user_id)
@cloud_account.update_column(:ci_user_id, current_user.user_id)
end
render_ok
rescue Exception => ex