Skip to content

Adds add_external_participants_from_cc to Service Desk settings page

What does this MR do and why?

Contributes to Service Desk should add emails in the To line a... (#4652 - closed)

This feature is hidden behind the feature flag 🎏 issue_email_participants.

When a received Service Desk email contains CC addresses they are now also added as external issue email participants if the settings flag add_external_participants_from_cc in ServiceDeskSetting is checked.

This MR adds the checkbox add_external_participants_from_cc to the Service Desk settings section on the projects settings page.

Related MRs

Screenshots or screen recordings

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

Before After
Screenshot_2023-10-24_at_17.08.11 Screenshot_2023-10-24_at_17.21.33

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. Visit http://127.0.0.1:3000/flightjs/Flight/edit and expand the Service Desk section. You should not see a checkbox with the label Add external participants from Cc header because the feature flag is disabled by default.
  3. Select the project and enable the feature flag for issue_email_participants.
    project = Project.find(7)
    Feature.enable(:issue_email_participants, project)
  4. Visit http://127.0.0.1:3000/flightjs/Flight/edit and expand the Service Desk section and find the Add external participants from Cc header checkbox at the bottom of the settings form and check the checkbox.
  5. Select Save changes. You should see a success alert. The checkbox should stay checked.
  6. Feel free to check the request and response in the dev tools. Both the request and the response should contain add_external_participants_from_cc in the payload.
  7. Reload the settings page. The checkbox should still be checked.
  8. Uncheck the checkbox and select Save changes. The checkbox should stay unchecked.
  9. (Optional) Use this to rollback the changes to your project
    ServiceDeskSettings::UpdateService.new(project, User.first, add_external_participants_from_cc: false).execute
    Feature.disable(:issue_email_participants, project)

Test full feature

  1. Perform the steps above and have a setup where the setting is set to true and the feature flag is enabled.
  2. Ingest a test email that will create a new Service Desk issue and will add the CC'ed email addresses to the issue
    service_desk_address = project.service_desk_incoming_address
    
    email_raw = <<~EMAIL
    To: #{service_desk_address}
    From: user@example.com
    Cc: cc@example.com
    Subject: CC SD issue
    
    This issue should have the author and cc as external participants.
    EMAIL
    
    EmailReceiverWorker.new.perform(email_raw)
  3. Check that it worked in the console
    issue = Issue.last
    puts issue.title
    puts issue.issue_email_participants.pluck(:email).join(', ')
  4. Check that it worked in he frontend
  5. Find the newly created issue and scroll down to the editor. You should find a warning below the editor that states that those three email addresses will be notified by comments.
  6. FYI: System notes for this will follow up shortly.

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