Fix user removal from a team [SCI-6323]

This commit is contained in:
Oleksii Kriuchykhin 2021-12-06 14:24:59 +01:00
parent 561746158e
commit 30031e2f07
2 changed files with 3 additions and 2 deletions

View file

@ -139,7 +139,8 @@ module Users
@user_t.destroy(new_owner)
end
rescue Exception
rescue StandardError => e
Rails.logger.error e.message
invalid = true
end
end

View file

@ -18,7 +18,7 @@ class UserTeam < ApplicationRecord
def destroy_associations
# Destroy the user from all team's projects
team.projects.joins(:user_projects).where(user_projects: { user: user }).destroy_all
user.user_projects.joins(:project).where(project: team.projects).destroy_all
# destroy all assignments
UserAssignments::RemoveUserAssignmentJob.perform_now(user, team)
end