mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 11:57:16 +08:00
Fix user removal from a team [SCI-6323]
This commit is contained in:
parent
561746158e
commit
30031e2f07
2 changed files with 3 additions and 2 deletions
|
@ -139,7 +139,8 @@ module Users
|
||||||
|
|
||||||
@user_t.destroy(new_owner)
|
@user_t.destroy(new_owner)
|
||||||
end
|
end
|
||||||
rescue Exception
|
rescue StandardError => e
|
||||||
|
Rails.logger.error e.message
|
||||||
invalid = true
|
invalid = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ class UserTeam < ApplicationRecord
|
||||||
|
|
||||||
def destroy_associations
|
def destroy_associations
|
||||||
# Destroy the user from all team's projects
|
# 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
|
# destroy all assignments
|
||||||
UserAssignments::RemoveUserAssignmentJob.perform_now(user, team)
|
UserAssignments::RemoveUserAssignmentJob.perform_now(user, team)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue