Adds system note when external participants have been added from CC
Feature context
Contributes to Service Desk should add emails in the To line a... (#4652 - closed)
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.
What does this MR do and why?
Solves Service Desk should add emails in the To line a... (#4652 - closed)
Adds system note when external participants have been added from CC
. Users can set that they want to automatically add CC
ed emails to a Service Desk issue in the project settings. When the feature flag and the feature toggle are enabled this also adds a system note listing the emails that have been added.
This also introduces a new abstraction IssueEmailParticipants::CreateService
to add external participants to a target
(whatever supports issue_email_participants
, right now only scoped to issues). This has been done because we have a few places where we add external participants and the implementation is almost always the same. So this MR also refactors the current logic for the /invite_email
quick action.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
The screenshot below shows the system note after adding one email from the CC
header of the incoming email.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Select a project and enable the feature flag for
issue_email_participants
.project = Project.find(7) Feature.enable(:issue_email_participants, project)
- Enable the setting. (you can also do this in the UI. Visit
http://127.0.0.1:3000/flightjs/Flight/edit
, expand the Service Desk section and check the checkboxAdd external participants from the Cc header
and select Save changes.)ServiceDeskSettings::UpdateService.new(project, User.first, add_external_participants_from_cc: true).execute
- Ingest a sample email with a
CC
field.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)
- Visit the issue detail page of your newly created issue (
http://127.0.0.1:3000/flightjs/Flight/-/issues/service_desk
). You should find a system note that lists theCC
emails. - (Optional) Add a comment with
/invite_email manually_added@example.com
. You should see a new system note entry with the mentioned email. - (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)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.