Skip to content

Adds Service Desk settings custom email form component

Marc Saleiko requested to merge ms-sd-settings-custom-email-form into master

Feature context

Click to expand 👇

Right now it is not possible to customize the Service Desk email address (intake and sending) in its entirety. On self-hosted instances you have more control over the used addresses, but you will still have a rather cryptic target email address for a specific service desk in a project. For .com users it's currently not possible to customize the Service Desk email at all.

There is a proposal and a further exploration around this issue. A summary of the solution path is the following: Users set up their custom email to forward all emails to the cryptic Service Desk email and provide SMTP credentials so we can send emails on their behalf. This way customers seeking support will only see the custom email address in their communication.

There is further discussion about improving and changing the general infrastructure, but this approach is a MVC to solve the issue for our customers.

🗺 How does it contribute to the whole feature?

This MR is part of a series of MRs that will follow in order to complete this feature. See #329990 (comment 1227384943) for a detailed breakdown. Here's a summary:

  1. Using SMTP credentials. Foundation work.
  2. Verify email ownership, correct function and setup
  3. 🎯 Add settings and validation to Settings page.
    • Backend
      1. Create and Destroy Services
      2. CustomEmailController
    • Frontend
      1. CustomEmail component foundation with initial resource fetching - merge request dependency
      2. 🎯 CustomEmailForm component with resource saving
      3. 🚫 CustomEmailStateStarted and CustomEmailConfirmModal components (with resource deletion)
      4. 🚫 CustomEmailStateFailed component (with resource deletion)
      5. 🚫 CustomEmailStateFinished component with resource update
  4. Ingest replies from custom email
  5. 👷🏻 Add documentation

What does this MR do and why?

Adds Service Desk settings custom email compone... (!126532 - merged) is a merge request dependency and this MR targets the dependency's branch to clean up diffs. Once !126532 (merged) has been merged, I'll rebase this MR on the current master. Rebased on master.

🎏 This feature is hidden behind a feature flag and not used on production yet.

This MR adds the CustomEmailForm component to the CustomEmail component. The CustomEmailForm component will be rendered when no custom email has been set up yet. So the user needs to provide the SMTP data and set up email forwarding. On submit, the CustomEmailForm component emits a submit event with the form data. The CustomEmail component takes that event and sends the create request to the backend and displays a toast on success and an alert on failure. The form should disappear. The next MR will add the next screen (verification state started).

Screenshots or screen recordings

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

Before After
Screenshot_2023-07-14_at_16.20.45 image

Resource fetched, no custom email configured yet --> show form:

image

All fields with validation errors:

image

All fields filled out, button enabled:

image

How to set up and validate locally

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

  1. Turn on (at least) incoming_email in your gitlab.yml.

  2. Enable service_desk_custom_email feature flag 🎏, e.g. for Flight project:

    Feature.enable(:service_desk_custom_email, Project.find(7)) # or your project id
  3. Browse to http://127.0.0.1:3000/flightjs/Flight/edit and expand the Service Desk section and find the custom email card below the general settings.

  4. Fill in the fields and see that the save button is only enabled with valid input data. Also see validation messages on error.

  5. Open the network tab of the dev tools and hit the send button. You should see a POST request to the backend with your input. The response should contain some of your input data and a toast should display that the custom email was saved.

  6. You should see a warning alert on error (network or logic).

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