Merge pull request #4521 from okriuchykhin/ok_SCI_7325

Fix protocol import in templates [SCI-7325]
This commit is contained in:
Alex Kriuchykhin 2022-10-14 11:19:29 +02:00 committed by GitHub
commit c725e1f100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -48,7 +48,7 @@ module Assignable
return if skip_user_assignments
role = if is_a?(Project) || is_a?(Team)
UserRole.find_by(name: I18n.t('user_roles.predefined.owner'))
UserRole.find_predefined_owner_role
else
permission_parent.user_assignments.find_by(user: created_by).user_role
end

View file

@ -8,8 +8,9 @@ class Protocol < ApplicationRecord
include PermissionCheckableModel
include TinyMceImages
after_save :update_linked_children
after_destroy :decrement_linked_children
after_save :update_linked_children
skip_callback :create, :after, :create_users_assignments, if: -> { in_module? }
enum protocol_type: {
unlinked: 0,

View file

@ -787,6 +787,7 @@ class TeamImporter
protocol.archived_by_id = find_user(protocol.archived_by_id)
protocol.restored_by_id = find_user(protocol.restored_by_id)
protocol.my_module = my_module unless protocol.my_module_id.nil?
protocol.skip_user_assignments = true
protocol.parent_id = @protocol_mappings[protocol.parent_id] unless protocol.parent_id.nil?
protocol.save!
@protocol_counter += 1