From c80cbe34f4c97bc996fa5c5bafa71704e0d44738 Mon Sep 17 00:00:00 2001 From: artoscinote <85488244+artoscinote@users.noreply.github.com> Date: Mon, 6 Dec 2021 14:27:26 +0100 Subject: [PATCH] Remove invalid designated users when moving experiment [SCI-6335] (#3722) --- app/services/experiments/move_to_project_service.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/services/experiments/move_to_project_service.rb b/app/services/experiments/move_to_project_service.rb index d780c1b16..e6cacd3d9 100644 --- a/app/services/experiments/move_to_project_service.rb +++ b/app/services/experiments/move_to_project_service.rb @@ -31,6 +31,7 @@ module Experiments raise end sync_user_assignments(my_module) + clean_up_user_my_modules(my_module) move_tags!(my_module) end @@ -119,6 +120,10 @@ module Experiments UserAssignments::GenerateUserAssignmentsJob.perform_later(object, @user) end + def clean_up_user_my_modules(my_module) + my_module.user_my_modules.where.not(user_id: @project.users.select(:id)).destroy_all + end + def track_activity Activities::CreateActivityService .call(activity_type: :move_experiment,