fix: org delete status error

This commit is contained in:
yystopf 2021-12-07 13:46:43 +08:00 committed by Gitea
parent 922561afb1
commit c5f22e6c70
1 changed files with 5 additions and 3 deletions

View File

@ -57,12 +57,14 @@ class Organizations::OrganizationsController < Organizations::BaseController
def destroy def destroy
tip_exception("密码不正确") unless current_user.check_password?(password) tip_exception("密码不正确") unless current_user.check_password?(password)
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
gitea_status, gitea_message = Gitea::Organization::DeleteService.call(current_user.gitea_token, @organization.login) gitea_destroy = Gitea::Organization::DeleteService.call(current_user.gitea_token, @organization.login)
if gitea_status == 204 if gitea_destroy[:status] == 204
@organization.destroy! @organization.destroy!
render_ok render_ok
else elsif gitea_destroy[:status] == 500
tip_exception("当组织内含有仓库时,无法删除此组织") tip_exception("当组织内含有仓库时,无法删除此组织")
else
tip_exception("")
end end
end end
rescue Exception => e rescue Exception => e