fix: delete organization tip
This commit is contained in:
parent
0885575cc4
commit
1f989d0a37
|
@ -46,7 +46,7 @@ class Organizations::OrganizationsController < Organizations::BaseController
|
|||
@organization.save!
|
||||
sync_organization_extension!
|
||||
|
||||
Gitea::Organization::UpdateService.call(@organization.gitea_token, login, @organization.reload)
|
||||
Gitea::Organization::UpdateService.call(current_user.gitea_token, login, @organization.reload)
|
||||
Util.write_file(@image, avatar_path(@organization)) if params[:image].present?
|
||||
end
|
||||
rescue Exception => e
|
||||
|
@ -57,10 +57,14 @@ class Organizations::OrganizationsController < Organizations::BaseController
|
|||
def destroy
|
||||
tip_exception("密码不正确") unless current_user.check_password?(password)
|
||||
ActiveRecord::Base.transaction do
|
||||
Gitea::Organization::DeleteService.call(@organization.gitea_token, @organization.login)
|
||||
@organization.destroy!
|
||||
gitea_status, gitea_message = Gitea::Organization::DeleteService.call(current_user.gitea_token, @organization.login)
|
||||
if gitea_status == 204
|
||||
@organization.destroy!
|
||||
render_ok
|
||||
else
|
||||
tip_exception("当组织内含有仓库时,无法删除此组织")
|
||||
end
|
||||
end
|
||||
render_ok
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
|
|
|
@ -144,6 +144,8 @@ class Gitea::ClientService < ApplicationService
|
|||
{status: 403, message: '你没有权限操作!'}
|
||||
when 404
|
||||
{status: 404, message: '你访问的链接不存在!'}
|
||||
when 500
|
||||
{status: 500, message: ''}
|
||||
else
|
||||
if response&.body.blank?
|
||||
message = "请求失败"
|
||||
|
|
Loading…
Reference in New Issue