Skip to content

Fix sync issue_type when creating issue using /promote_to_incident

Mario Celi requested to merge 403157-fix-sync-issue-type-promoting-incident into master

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

  1. Create a new issue using the quickaction /promote_to_incident in the issue's description
  2. Go to the rails console and find the newly created issue issue = Issue.last
  3. Issue type should be incident. issue.issue_type => 'incident'
  4. 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.

Related to #403157 (closed)

Edited by Mario Celi

Merge request reports