fixed 导入失败的项目标记 project.status=0, 在列表中不显示
This commit is contained in:
parent
30a17f53b3
commit
9de04dba7e
|
@ -317,7 +317,10 @@ class ProjectsController < ApplicationController
|
||||||
UpdateProjectTopicJob.set(wait: 1.seconds).perform_later(project_id) if project_id.present?
|
UpdateProjectTopicJob.set(wait: 1.seconds).perform_later(project_id) if project_id.present?
|
||||||
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?
|
||||||
|
# 导入失败的项目标记 project.status=0, 在列表中不显示
|
||||||
|
@project&.update_columns(status: 0) if @project&.status == 1
|
||||||
|
|
||||||
# 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!
|
||||||
|
|
|
@ -22,6 +22,7 @@ class MigrateRemoteRepositoryJob < ApplicationJob
|
||||||
gitea_result = $gitea_client.get_repos_by_owner_repo(repo&.project&.owner&.login, repo&.project&.identifier)
|
gitea_result = $gitea_client.get_repos_by_owner_repo(repo&.project&.owner&.login, repo&.project&.identifier)
|
||||||
if gitea_result["empty"]
|
if gitea_result["empty"]
|
||||||
repo&.mirror&.failed!
|
repo&.mirror&.failed!
|
||||||
|
repo&.project&.update_columns(status: 0)
|
||||||
else
|
else
|
||||||
repo&.project&.update_columns(gpid: gitea_result["id"])
|
repo&.project&.update_columns(gpid: gitea_result["id"])
|
||||||
repo&.mirror&.succeeded!
|
repo&.mirror&.succeeded!
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Projects::ListQuery < ApplicationQuery
|
||||||
end
|
end
|
||||||
|
|
||||||
def main_collection
|
def main_collection
|
||||||
collection = Project.visible
|
collection = Project.visible.where(status: 1)
|
||||||
# 增加私有组织中项目过滤
|
# 增加私有组织中项目过滤
|
||||||
collection = collection.joins("left join organization_extensions on organization_extensions.organization_id = projects.user_id")
|
collection = collection.joins("left join organization_extensions on organization_extensions.organization_id = projects.user_id")
|
||||||
.where("organization_extensions.visibility is null or organization_extensions.visibility in (0,1)")
|
.where("organization_extensions.visibility is null or organization_extensions.visibility in (0,1)")
|
||||||
|
|
Loading…
Reference in New Issue