更改:导入项目失败不删除项目永远返回-1
This commit is contained in:
parent
c53b084538
commit
ac815ed9a2
|
@ -318,12 +318,12 @@ class ProjectsController < ApplicationController
|
||||||
Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status} ############"
|
Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status} ############"
|
||||||
end
|
end
|
||||||
elsif !@project.common? && @project&.repository&.mirror&.failed?
|
elsif !@project.common? && @project&.repository&.mirror&.failed?
|
||||||
Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status}"
|
# Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status}"
|
||||||
Gitea::Repository::DeleteService.new(@project.owner, @project.identifier,current_user.gitea_token).call
|
# Gitea::Repository::DeleteService.new(@project.owner, @project.identifier,current_user.gitea_token).call
|
||||||
@project.destroy!
|
# @project.destroy!
|
||||||
@project.forked_projects.update_all(forked_from_project_id: nil)
|
# @project.forked_projects.update_all(forked_from_project_id: nil)
|
||||||
# 如果该项目有所属的项目分类以及为私有项目,需要更新对应数量
|
# # 如果该项目有所属的项目分类以及为私有项目,需要更新对应数量
|
||||||
@project.project_category.decrement!(:private_projects_count, 1) if @project.project_category.present? && !@project.is_public
|
# @project.project_category.decrement!(:private_projects_count, 1) if @project.project_category.present? && !@project.is_public
|
||||||
return render_error("导入失败,请重试!")
|
return render_error("导入失败,请重试!")
|
||||||
end
|
end
|
||||||
# 为了缓存活跃项目的基本信息,后续删除
|
# 为了缓存活跃项目的基本信息,后续删除
|
||||||
|
|
Loading…
Reference in New Issue