Skip to content

Adds convert_to_ticket quick action

Marc Saleiko requested to merge ms-add-make-service-desk-issue-quickaction into master

What does this MR do and why?

Contributes to Create Service Desk tickets from the UI and API (#433376 - closed)

The feature is hidden behind the (beta) feature flag 🎏 convert_to_ticket_quick_action.

This merge request introduces a new quick action for issues, called /convert_to_ticket user@example.com. This action allows users to convert an existing issue into a Service Desk issue.

This is the first iteration on this so this MR doesn't:

  1. add a system note that states that an external participant has been added (can only be done after !141612 (merged) has been merged)
  2. add a system note that the issue has been converted
  3. support using the quick action on an unpersisted issue
  4. actually convert to the work item type ticket but changes the issue so it's a Service Desk issue per definition of today

What makes a Service Desk issue

It's a regular issue (long term migration to work item type ticket), but

  1. Author is the GitLab Support-Bot (Users::Internal.support_bot)
  2. service_desk_reply_to is populated with an email address
  3. (technically optional) at least one IssueEmailParticipant has been added (normally the address from service_desk_reply_to field)
  4. (technically optional) is confidential (can be made public again).

Issue update query

We call update! on the issue. This is the query and the query plan:

UPDATE "issues" SET "author_id" = 46, "updated_at" = '2024-01-31 14:40:57.994593', 
"confidential" = TRUE, "service_desk_reply_to" = 'user@example.com' 
WHERE "issues"."id" = 669
Update on issues  (cost=0.57..3.58 rows=0 width=0)  
  ->  Index Scan using issues_pkey on issues  (cost=0.57..3.58 rows=1 width=51)  
        Index Cond: (id = 669)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Quick action autocomplete

image

Internal comment after transformation

image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. If you haven't set up incoming_email or service_desk_email for email ingestion, please add this to your gitlab.yml file in the development: section. Please restart GDK with gdk restart:
    incoming_email:
      enabled: true
      address: "incoming+%{key}@example.com"
    This will allow you to see the Service Desk section in the settings and generate project-specific email addresses. You won't be able to ingest emails, but we don't need that here.
  2. Select a project and enable the feature flag for convert_to_ticket_quick_action.
    project = Project.find(7)
    
    Feature.enable(:convert_to_ticket_quick_action, project)
  3. Add a new issue in the project.
  4. Now add a new comment and start typing /convert_to_ticket user@example.com. The Autocomplete should list the convert_to_ticket command.
  5. Submit the comment and see the success message and a new internal comment from GitLab Support-Bot that mentiones the original author of the issue and the email address that has been added as the external author.
  6. Reload the issue to see all Service Desk ticket details (email address is listed in header and warning below comment editor that external participants will be notified).

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marc Saleiko

Merge request reports