Automatically add CC as issue email participants
What does this MR do and why?
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.
The add_external_participants_from_cc
database field was introduced in Adds add_external_participants_from_cc to Servi... (!133859 - merged) • Marc Saleiko • 16.5. The frontend part on the project settings page will follow shortly.
Screenshots or screen recordings
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)
- Ingest a sample eamail 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)
- Because the
add_external_participants_from_cc
flag inServiceDeskSetting
isfalse
by default this should add an issue with only one external participant (the author).issue = Issue.last puts issue.title puts issue.issue_email_participants.pluck(:email).join(', ')
- Now enable the setting
ServiceDeskSettings::UpdateService.new(project, User.first, add_external_participants_from_cc: true).execute
- Repeat steps 2) and 3). This time you should see two external participants.
- You can also check for more than one
CC
with the email snippet from below and repeating steps 2) and 3).email_raw = <<~EMAIL To: #{service_desk_address} From: user@example.com Cc: cc@example.com, dd@example.com Subject: CC SD issue This issue should have the author and cc as external participants. 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.