From ec0657b7b9e2365f6d5dc95016a0e181233d96f7 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Tue, 4 Apr 2023 11:20:38 +0200 Subject: [PATCH] Properly copy visibility and public assignments when cloning protocol [SCI-8259] --- app/models/protocol.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/protocol.rb b/app/models/protocol.rb index 7829eff7d..d14cc8cc8 100644 --- a/app/models/protocol.rb +++ b/app/models/protocol.rb @@ -598,7 +598,9 @@ class Protocol < ApplicationRecord last_modified_by: current_user, team: team, protocol_type: :in_repository_draft, - skip_user_assignments: true + skip_user_assignments: true, + visibility: visibility, + default_public_user_role_id: default_public_user_role_id ) cloned = deep_clone(clone, current_user) @@ -697,6 +699,8 @@ class Protocol < ApplicationRecord end def update_automatic_user_assignments + return if skip_user_assignments + case visibility when 'visible' create_or_update_public_user_assignments!(added_by)