From 565c1c1cab199695543f13650a97b1658e671e8e Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 18 Apr 2024 16:14:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=88=86=E6=94=AF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=88=86=E6=94=AF=E6=9F=A5=E8=AF=A2=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=8E=92=E5=BA=8F=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/v1/projects/sync_repositories_controller.rb | 3 ++- app/controllers/application_controller.rb | 2 +- .../api/v1/projects/sync_repositories/branches.json.jbuilder | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/projects/sync_repositories_controller.rb b/app/controllers/api/v1/projects/sync_repositories_controller.rb index 9586b2c2d..e9fe44007 100644 --- a/app/controllers/api/v1/projects/sync_repositories_controller.rb +++ b/app/controllers/api/v1/projects/sync_repositories_controller.rb @@ -52,7 +52,8 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController def branches return render_error("请输入正确的同步项目ID") unless params[:sync_repository_ids].present? - @sync_repository_branches = SyncRepositoryBranch.where(sync_repository_id: params[:sync_repository_ids].split(",")) + @sync_repository_branches = SyncRepositoryBranch.where(sync_repository_id: params[:sync_repository_ids].split(",")).order(updated_at: :desc) + @sync_repository_branches = @sync_repository_branches.ransack(gitlink_branch_name_or_external_branch_name_cont: params[:branch_name]).result if params[:branch_name].present? @group_sync_repository_branch = @sync_repository_branches.group(:gitlink_branch_name, :external_branch_name).count end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0c134a3bd..3fbd29fd9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -348,7 +348,7 @@ class ApplicationController < ActionController::Base User.current = User.find 8686 elsif params[:debug] == 'admin' logger.info "@@@@@@@@@@@@@@@@@@@@@@ debug mode....." - user = User.find 36480 + user = User.find 102 User.current = user cookies.signed[:user_id] = user.id end diff --git a/app/views/api/v1/projects/sync_repositories/branches.json.jbuilder b/app/views/api/v1/projects/sync_repositories/branches.json.jbuilder index 4f548ee1a..09ef2e84d 100644 --- a/app/views/api/v1/projects/sync_repositories/branches.json.jbuilder +++ b/app/views/api/v1/projects/sync_repositories/branches.json.jbuilder @@ -4,6 +4,7 @@ json.sync_repository_branches @group_sync_repository_branch.each do |key| json.external_branch_name key[0][1] branches = @sync_repository_branches.where(gitlink_branch_name: key[0][0], external_branch_name: key[0][1]).order(updated_at: :desc) branch = branches.first + json.type branch&.sync_repository&.type json.sync_time branch.sync_time json.sync_status branch.sync_status json.enable branch.enable