Browse Source

Merge branch 'standalone_develop' of https://gitlink.org.cn/Trustie/forgeplus into standalone_develop

pull/347/head
yystopf 2 years ago
parent
commit
814aa55578
3 changed files with 6 additions and 2 deletions
  1. +4
    -1
      app/controllers/projects_controller.rb
  2. +1
    -0
      app/jobs/migrate_remote_repository_job.rb
  3. +1
    -1
      app/queries/projects/list_query.rb

+ 4
- 1
app/controllers/projects_controller.rb View File

@@ -319,7 +319,10 @@ class ProjectsController < ApplicationController
UpdateProjectTopicJob.set(wait: 1.seconds).perform_later(project_id) if project_id.present?
Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status} ############"
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}"
# Gitea::Repository::DeleteService.new(@project.owner, @project.identifier,current_user.gitea_token).call
# @project.destroy!


+ 1
- 0
app/jobs/migrate_remote_repository_job.rb View File

@@ -22,6 +22,7 @@ class MigrateRemoteRepositoryJob < ApplicationJob
gitea_result = $gitea_client.get_repos_by_owner_repo(repo&.project&.owner&.login, repo&.project&.identifier)
if gitea_result["empty"]
repo&.mirror&.failed!
repo&.project&.update_columns(status: 0)
else
repo&.project&.update_columns(gpid: gitea_result["id"])
repo&.mirror&.succeeded!


+ 1
- 1
app/queries/projects/list_query.rb View File

@@ -38,7 +38,7 @@ class Projects::ListQuery < ApplicationQuery
end

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")
.where("organization_extensions.visibility is null or organization_extensions.visibility in (0,1)")


Loading…
Cancel
Save