Fix sync issue_type when creating issue using /promote_to_incident
What does this MR do and why?
In !106366 (merged) we introduced the ability to use the promote_to_incident
quickaction when creating an issue. The problem with the current implementation is that it syncs both the issue_type
and work_item_type_id
columns in the after_create
block, so the changes are never persisted https://gitlab.com/gitlab-org/gitlab/-/blob/c4fec8bfd29cec45906992e5ed5dffa46e47582f/app/services/issues/create_service.rb#L79
We need to change the order in which the quickaction params are extracted when the issue is created (it works fine when updating issues https://gitlab.com/gitlab-org/gitlab/-/blob/4cbad001a9eacd3efb938e785d982148821c6df6/app/services/issuable_base_service.rb#L299).
How to set up and validate locally
- Create a new issue using the quickaction
/promote_to_incident
in the issue's description - Go to the rails console and find the newly created issue
issue = Issue.last
- Issue type should be
incident
.issue.issue_type => 'incident'
- Issue work item type will be
issue
.issue.work_item_type.base_type => 'issue'
With this change, the work item type should also be incident
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #403157 (closed)