Send email with attachment exporting work items as CSV
What does this MR do and why?
We did add the ability to parse work items as CSV with !110567 (merged), now this MR allows to send the CSV file as an attachment to the user.
It basically uses the same email to export issues for work items, just replacing the words on the subject and text body.
In a follow-up MR we will support exporting work items as CSV from a GraphQL mutation.
Screenshots or screen recordings
I did emulate a truncated email with more work items than it is possible to export so we can check how the truncated message looks. I also included a custom header, footer and additional text from admin panel.
Export email as html
Export email as text
How to set up and validate locally
- Create a project and create 1 requirement, 1 issue and 1 incident
- Go to the rails console and execute the following script:
p = Project.find_by_full_path(PROJECT_PATH)
relation = WorkItem.where(project: p) # For some reason we do not have this relationship on Project
WorkItems::ExportCsvService.new(relation, p).email(User.first)
- Use letter opener on http://127.0.0.1:3000/rails/letter_opener/ and check the email and the attachment.
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.
Edited by Felipe Cardozo