Also delete user_my_modules when deleting MyModule assignments [SCI-6252] (#3651)

This commit is contained in:
artoscinote 2021-11-10 14:45:24 +01:00 committed by GitHub
parent 9ad287e994
commit 9181be22c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,6 +50,9 @@ module UserAssignments
end
def destroy_user_assignment(object)
# also destroy user designations if it's a MyModule
object.user_my_modules.where(user: @user).destroy_all if object.is_a?(MyModule)
UserAssignment.where(user: @user, assignable: object).destroy_all
end
end