Merge pull request #5248 from artoscinote/ma_SCI_8259

Properly copy visibility and public assignments when cloning protocol [SCI-8259]
This commit is contained in:
Alex Kriuchykhin 2023-04-04 11:31:21 +02:00 committed by GitHub
commit ed9f3d49d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -594,7 +594,9 @@ class Protocol < ApplicationRecord
last_modified_by: current_user, last_modified_by: current_user,
team: team, team: team,
protocol_type: :in_repository_draft, 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) cloned = deep_clone(clone, current_user)
@ -693,6 +695,8 @@ class Protocol < ApplicationRecord
end end
def update_automatic_user_assignments def update_automatic_user_assignments
return if skip_user_assignments
case visibility case visibility
when 'visible' when 'visible'
create_or_update_public_user_assignments!(added_by) create_or_update_public_user_assignments!(added_by)