FIX delete webhook for bind ci service

This commit is contained in:
Jasder 2020-09-04 16:26:00 +08:00
parent 930f8195b7
commit 48350dc6f2
1 changed files with 4 additions and 2 deletions

View File

@ -141,8 +141,10 @@ class Ci::CloudAccountsController < Ci::BaseController
# TODO
# 删除用户项目下的与ci相关的所有webhook
user.projects.select(:id, :identifier, :gitea_webhook_id).each do |project|
result = Gitea::Hooks::DestroyService.call(user.gitea_token, user.login, project.identifier, project.gitea_webhook_id) unless project.gitea_webhook_id.blank?
project.update_column(:gitea_webhook_id, nil) if result.status == 204
if project.gitea_webhook_id
result = Gitea::Hooks::DestroyService.call(user.gitea_token, user.login, project.identifier, project.gitea_webhook_id)
project.update_column(:gitea_webhook_id, nil) if result.status == 204
end
end
end