diff options
Diffstat (limited to 'app/services/issues/build_service.rb')
-rw-r--r-- | app/services/issues/build_service.rb | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/app/services/issues/build_service.rb b/app/services/issues/build_service.rb index a65fc0c7c87..63cad593936 100644 --- a/app/services/issues/build_service.rb +++ b/app/services/issues/build_service.rb @@ -83,18 +83,17 @@ module Issues params.delete(:work_item_type) end - base_type = work_item_type&.base_type - - if create_issue_type_allowed?(container, base_type) - issue.work_item_type = work_item_type - # Up to this point issue_type might be set to the default, so we need to sync if a work item type is provided - issue.issue_type = base_type - else - # If no work item type was provided or not allowed, we need to set it to issue_type, - # and that includes the column default - issue_type = issue_params[:issue_type] || ::Issue::DEFAULT_ISSUE_TYPE - issue.work_item_type = WorkItems::Type.default_by_type(issue_type) - end + # We need to support the legacy input params[:issue_type] even if we don't have the issue_type column anymore. + # In the future only params[:work_item_type] should be provided + base_type = work_item_type&.base_type || params[:issue_type] + + issue.work_item_type = if create_issue_type_allowed?(container, base_type) + work_item_type || WorkItems::Type.default_by_type(base_type) + else + # If no work item type was provided or not allowed, we need to set it to + # the default issue_type + WorkItems::Type.default_by_type(::Issue::DEFAULT_ISSUE_TYPE) + end end def model_klass @@ -109,8 +108,6 @@ module Issues :confidential ] - public_issue_params << :issue_type if create_issue_type_allowed?(container, params[:issue_type]) - params.slice(*public_issue_params) end |