From b236733637c6ebae467e500c48445714a65640f8 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Mon, 29 Apr 2024 11:11:01 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E8=A7=A3=E6=95=A3=E5=9B=A2=E9=98=9F?= =?UTF-8?q?=E4=B8=AD=E6=88=90=E5=91=98=E5=9C=A8=E5=85=B6=E4=BB=96=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=85=B6=E4=BB=96=E5=9B=A2=E9=98=9F=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E6=88=90=E5=91=98=E9=9C=80=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations/teams_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/organizations/teams_controller.rb b/app/controllers/organizations/teams_controller.rb index 90bc4a534..56172a61e 100644 --- a/app/controllers/organizations/teams_controller.rb +++ b/app/controllers/organizations/teams_controller.rb @@ -67,10 +67,11 @@ class Organizations::TeamsController < Organizations::BaseController tip_exception("组织团队不允许被删除") if @team.owner? ActiveRecord::Base.transaction do Gitea::Organization::Team::DeleteService.call(@organization.gitea_token, @team.gtid) - all_user_ids = @organization.team_users.pluck(:user_id) + other_user_ids = @organization.team_users.where.not(team_id: @team.id).pluck(:user_id) team_user_ids = @team.team_users.pluck(:user_id) # 当前删除团队中成员在其他组织其他团队不存在的成员需清除组织 - remove_user_ids = team_user_ids - all_user_ids + remove_user_ids = team_user_ids - other_user_ids + Rails.logger.info "remove_user_ids ===========> #{remove_user_ids}" @team.destroy! if remove_user_ids.present? User.where(id: remove_user_ids).each do |user|