Skip to content

Adds Service Desk new participant email

Marc Saleiko requested to merge ms/service-desk/add-new-participant-email into master

What does this MR do and why?

Contributes to External participants are notified when added a... (#299261 - closed)

Epic: Participants in Service Desk (&3758)

This feature is hidden behind the feature flag 🎏 issue_email_participants. It'll be enabled for production shortly and probably enabled by default for 17.0.

One aspect of the "external participants" feature is to automatically include CCed emails in the issue from the start.

We send a thank_you email to the external author on Service Desk ticket creation but not to all other external participants when they're added. This MR introduces a new email service_desk_new_participant_email which will be sent whenever an external participant has been added to a work item. This applies for both participants added via CC header and added via quick action.

This is the setting in the frontend (General project settings --> Service Desk section) after you enabled the feature flag. To verify locally we just update the field from the backend (see steps).

image

Also fixes exclusive lease issues in email previews.

Contributes to Fix exclusive lease usage in transaction for ap... (#441523 - closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

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

No before screenshots.

Mailer previews

http://127.0.0.1:3000/rails/mailers/notify/service_desk_new_participant_email.html?locale=en

Screenshot_2024-04-25_at_11.16.29

http://127.0.0.1:3000/rails/mailers/notify/service_desk_new_participant_email.txt?locale=en

image

How to set up and validate locally

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

So there are two concepts to test:

  1. Create a Service Desk ticket from an email with CCed emails. External author receives thank_you email, CCed emails receive new_participant email.
  2. Add external participant via /invite_email quick action on the ticket

Let's go 🚀

  1. View the email previews
    1. http://127.0.0.1:3000/rails/mailers/notify/service_desk_new_participant_email.html?locale=en
    2. http://127.0.0.1:3000/rails/mailers/notify/service_desk_new_participant_email.txt?locale=en
  2. 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 real emails, but we don't need that here.
  3. Select a project and enable the feature flag for issue_email_participants.
    project = Project.find(5)
    
    Feature.enable(:issue_email_participants, project)
  4. Enable to automatically add Cced emails to the issue
    ServiceDeskSettings::UpdateService.new(project, User.first, add_external_participants_from_cc: true).execute
  5. Ingest a sample email which will create a ticket in the selected project.
    service_desk_address = project.service_desk_incoming_address
    
    email_raw = <<~EMAIL
    To: #{service_desk_address}
    From: user@example.com
    Cc: cc@example.com
    Subject: SD issue
    
    This should send send a thank you email to user@example.com and a new participant email to cc@example.com
    EMAIL
    
    EmailReceiverWorker.new.perform(email_raw)
  6. Now open letter opener (http://127.0.0.1:3000/rails/letter_opener) and you should find a thank you email to user@example.com and a new participant email to cc@example.com. If they don't show up 😟 a gdk restart might help. In my installation some background jobs are stuck until I restart. Maybe that helps 👍
  7. Now browse to the newly created ticket in the frontend and add a new external participant using a quick action
    /invite_email invited@example.com
    You should see a success message and a new system note
  8. Reload letter opener and you should see another new participant email to invited@example.com. It should look somewhat like this: image
Edited by Marc Saleiko

Merge request reports