FIX 优化ci流程,并配置gitea相关database

This commit is contained in:
Jasder
2020-09-27 11:30:37 +08:00
parent 6cbb22acaf
commit a308862567
9 changed files with 138 additions and 27 deletions

View File

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