mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-26 16:53:12 +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)
|
||||
end
|
||||
rescue Exception
|
||||
rescue StandardError => e
|
||||
Rails.logger.error e.message
|
||||
invalid = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue