Skip to content

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

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.rb
index 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::SetAttributes
return 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.first
reassign_status assignable_statuses
end
diff --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.rb
index 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.rb
index 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 do
expect(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 priority
expect(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.rb
index 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 do
context 'a default type exists in new project' do
let(:new_types) { [other_type, default_type] }
- it 'uses the default type' do
+ it 'uses the first type (by position)' do
subject
expect(work_package.type)
- .to eql default_type
+ .to eql other_type
end
it 'adds change to system changes' do
subject
expect(work_package.changed_by_system['type_id'])
- .to eql [initial_type.id, default_type.id]
+ .to eql [initial_type.id, other_type.id]
end
end
context 'no default type exists in new project' do
let(:new_types) { [other_type, yet_another_type] }
- it 'uses the first type' do
+ it 'uses the first type (by position)' do
subject
expect(work_package.type)