更改:导入项目失败不删除项目永远返回-1

This commit is contained in:
yystopf 2024-06-05 15:08:06 +08:00
parent c53b084538
commit ac815ed9a2
1 changed files with 6 additions and 6 deletions

View File

@ -318,12 +318,12 @@ class ProjectsController < ApplicationController
Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status} ############"
end
elsif !@project.common? && @project&.repository&.mirror&.failed?
Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status}"
Gitea::Repository::DeleteService.new(@project.owner, @project.identifier,current_user.gitea_token).call
@project.destroy!
@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
# Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status}"
# Gitea::Repository::DeleteService.new(@project.owner, @project.identifier,current_user.gitea_token).call
# @project.destroy!
# @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
return render_error("导入失败,请重试!")
end
# 为了缓存活跃项目的基本信息,后续删除