mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-16 17:55:56 +08:00
FIX 优化ci流程,并配置gitea相关database
This commit is contained in:
@@ -57,4 +57,8 @@ class Ci::Repo < Ci::RemoteBase
|
||||
repo
|
||||
end
|
||||
end
|
||||
|
||||
def deactivate!
|
||||
update_column(:repo_active, 0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,6 +21,22 @@ module Droneable
|
||||
devops_unverified? && Ci::User.exists?(user_login: self.login)
|
||||
end
|
||||
|
||||
def unbind_account!
|
||||
user_projects = selef.projects
|
||||
|
||||
user_projects.update_all(open_devops: false, open_devops_count: 0)
|
||||
set_drone_step!(User::DEVOPS_UNINIT)
|
||||
|
||||
# TODO
|
||||
# 删除用户项目下的与ci相关的所有webhook
|
||||
user_projects.select(:id, :identifier, :gitea_webhook_id).each do |project|
|
||||
if project.gitea_webhook_id
|
||||
result = Gitea::Hooks::DestroyService.call(self.gitea_token, self.login, project.identifier, project.gitea_webhook_id)
|
||||
project.update_column(:gitea_webhook_id, nil) if result.status == 204
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
end
|
||||
end
|
||||
|
||||
@@ -180,4 +180,14 @@ class Project < ApplicationRecord
|
||||
return nil if project.blank?
|
||||
project
|
||||
end
|
||||
|
||||
def ci_reactivate?
|
||||
open_devops_count > 0
|
||||
end
|
||||
|
||||
def ci_reactivate!(ci_repo)
|
||||
ci_repo.update_column(:repo_active, 1)
|
||||
update_column(:open_devops, true)
|
||||
increment!(:open_devops_count)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user