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
choose wp type by position only (#9297)
ulferts0c2d87b4eb95
diff --git a/app/services/work_packages/set_attributes_service.rb b/app/services/work_packages/set_attributes_service.rbindex c3cace0713a..eedcffa11cf 100644--- a/app/services/work_packages/set_attributes_service.rb+++ b/app/services/work_packages/set_attributes_service.rb@@ -201,7 +201,7 @@ class WorkPackages::SetAttributesService < ::BaseServices::SetAttributesreturn if available_types.include?(work_package.type) && work_package.type- work_package.type = available_types.detect(&:is_default) || available_types.first+ work_package.type = available_types.firstreassign_status assignable_statusesenddiff --git a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rbindex 1c11a7aa6d3..85cee05d070 100644--- a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb+++ b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb@@ -596,7 +596,7 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma{guid: issue&.uuid,- topic_type: (base && base.type.name) || standard_type.name,+ topic_type: (base && base.type.name) || type.name,topic_status: (base && base.status.name) || default_status.name,priority: (base && base.priority.name) || default_priority.name,title: title,diff --git a/spec/services/work_packages/create_service_integration_spec.rb b/spec/services/work_packages/create_service_integration_spec.rbindex 6084c5e8c25..b1db85c922f 100644--- a/spec/services/work_packages/create_service_integration_spec.rb+++ b/spec/services/work_packages/create_service_integration_spec.rb@@ -111,9 +111,9 @@ describe WorkPackages::CreateService, 'integration', type: :model doexpect(new_work_package.status).to eql(default_status)- # assign the default type+ # assign the first type in the project (not related to is_default)expect(new_work_package.type)- .to eql(default_type)+ .to eql(type)# assign the default priorityexpect(new_work_package.priority)diff --git a/spec/services/work_packages/set_attributes_service_spec.rb b/spec/services/work_packages/set_attributes_service_spec.rbindex 79fae652c37..1402645e897 100644--- a/spec/services/work_packages/set_attributes_service_spec.rb+++ b/spec/services/work_packages/set_attributes_service_spec.rb@@ -776,25 +776,25 @@ describe WorkPackages::SetAttributesService, type: :model docontext 'a default type exists in new project' dolet(:new_types) { [other_type, default_type] }- it 'uses the default type' do+ it 'uses the first type (by position)' dosubjectexpect(work_package.type)- .to eql default_type+ .to eql other_typeendit 'adds change to system changes' dosubjectexpect(work_package.changed_by_system['type_id'])- .to eql [initial_type.id, default_type.id]+ .to eql [initial_type.id, other_type.id]endendcontext 'no default type exists in new project' dolet(:new_types) { [other_type, yet_another_type] }- it 'uses the first type' do+ it 'uses the first type (by position)' dosubjectexpect(work_package.type)