|
|
|
@@ -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| |
|
|
|
|