From 9181be22c8be3b0dd44145361f818044416a8887 Mon Sep 17 00:00:00 2001 From: artoscinote <85488244+artoscinote@users.noreply.github.com> Date: Wed, 10 Nov 2021 14:45:24 +0100 Subject: [PATCH] Also delete user_my_modules when deleting MyModule assignments [SCI-6252] (#3651) --- app/jobs/user_assignments/propagate_assignment_job.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/jobs/user_assignments/propagate_assignment_job.rb b/app/jobs/user_assignments/propagate_assignment_job.rb index 730454028..6def574d0 100644 --- a/app/jobs/user_assignments/propagate_assignment_job.rb +++ b/app/jobs/user_assignments/propagate_assignment_job.rb @@ -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