diff --git a/app/models/concerns/assignable.rb b/app/models/concerns/assignable.rb index 10b0671c6..e14634d93 100644 --- a/app/models/concerns/assignable.rb +++ b/app/models/concerns/assignable.rb @@ -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 diff --git a/app/models/protocol.rb b/app/models/protocol.rb index 0f50fa23d..fce2fb973 100644 --- a/app/models/protocol.rb +++ b/app/models/protocol.rb @@ -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, diff --git a/app/services/team_importer.rb b/app/services/team_importer.rb index 407186097..bc1b3df2c 100644 --- a/app/services/team_importer.rb +++ b/app/services/team_importer.rb @@ -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