OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
forgive missing assignee if so specified
ulfertse358e5d1fc8b
diff --git a/modules/bcf/app/services/bcf/issues/transform_attributes_service.rb b/modules/bcf/app/services/bcf/issues/transform_attributes_service.rbindex f5033766cd8..76ac8cda681 100644--- a/modules/bcf/app/services/bcf/issues/transform_attributes_service.rb+++ b/modules/bcf/app/services/bcf/issues/transform_attributes_service.rb@@ -56,9 +56,7 @@ module Bcf::Issuesreturn assignee if assignee.present?- if attributes[:assignee]- User::InexistentUser.new- end+ missing_assignee(attributes[:assignee], attributes[:import_options] || {})end##@@ -67,13 +65,13 @@ module Bcf::Issuesproject.users.find_by(mail: mail)end- def type(attributes)+ def type(project, attributes)type_name = attributes[:type]- type = ::Type.find_by(name: type_name)+ type = project.types.find_by(name: type_name)return type if type.present?- missing_type(type_name, attributes[:import_options] || {})+ missing_type(project, type_name, attributes[:import_options] || {})end##@@ -107,7 +105,7 @@ module Bcf::Issues{# Fixed attributes we knowproject: project,- type: type(attributes),+ type: type(project, attributes),# Native attributes from the extractorsubject: title(attributes),@@ -144,15 +142,21 @@ module Bcf::Issuesendend- def missing_type(type_name, import_options)- if import_options[:unknown_types_action] == 'default'- ::Type.default&.first+ def missing_type(project, type_name, import_options)+ if import_options[:unknown_types_action] == 'use_default'+ project.types.default&.firstelsif import_options[:unknown_types_action] == 'chose' &&import_options[:unknown_types_chose_ids].any?- ::Type.find_by(id: import_options[:unknown_types_chose_ids].first)+ project.types.find_by(id: import_options[:unknown_types_chose_ids].first)elsif type_nameType::InexistentType.newendend++ def missing_assignee(assignee_name, import_options)+ if import_options[:invalid_people_action] != 'anonymize' && assignee_name+ User::InexistentUser.new+ end+ endendenddiff --git a/modules/bcf/lib/open_project/bcf/bcf_xml/issue_reader.rb b/modules/bcf/lib/open_project/bcf/bcf_xml/issue_reader.rbindex ce553257028..d7cf56f71b6 100644--- a/modules/bcf/lib/open_project/bcf/bcf_xml/issue_reader.rb+++ b/modules/bcf/lib/open_project/bcf/bcf_xml/issue_reader.rb@@ -93,9 +93,9 @@ module OpenProject::Bcf::BcfXmldef work_package_attributesattributes = ::Bcf::Issues::TransformAttributesService.new- .call(extractor_attributes)+ .call(extractor_attributes.merge(import_options: import_options)).result- .merge(send_notifications: false, import_options: import_options)+ .merge(send_notifications: false).symbolize_keysattributes[:start_date] = extractor.creation_date.to_date unless is_updatediff --git a/modules/bcf/spec/bcf/bcf_xml/importer_spec.rb b/modules/bcf/spec/bcf/bcf_xml/importer_spec.rbindex 6a7d453d3ee..0782024674a 100644--- a/modules/bcf/spec/bcf/bcf_xml/importer_spec.rb+++ b/modules/bcf/spec/bcf/bcf_xml/importer_spec.rb@@ -63,7 +63,7 @@ describe ::OpenProject::Bcf::BcfXml::Importer doworkflowprioritybcf_manager_member- allow(User).to receive(:current).and_return(bcf_manager)+ login_as(bcf_manager)enddescribe '#to_listing' do