phac-nml / irida-next

IRIDA Next
https://phac-nml.github.io/irida-next/
Apache License 2.0
8 stars 2 forks source link

Adding manager email templates to pipeline mailer #586

Closed ksierks closed 2 months ago

ksierks commented 2 months ago

What does this PR do and why?

Sends user email to human pipeline submitter & sends manager emails if automated pipeline was submitted by bot. Fixes #575.

Screenshots or screen recordings

Pipeline completed manger email: image Pipeline errored manger email: image

How to set up and validate locally

  1. Install local mock email service, Mailhog.
  2. After setup, open a terminal and run ~/go/bin/MailHog.
  3. Run irida-next.
  4. Login as user1@email.com
  5. Create a personal project named test awe
  6. Add a few owners and maintainers to the project.
  7. Open a rails console and execute the following to add an automated workflow execution:
    AutomatedWorkflowExecutions::CreateService.new(User.find_by(email: 'user1@email.com'), { namespace: Namespaces::ProjectNamespace.find_by_full_path('user1_at_email.com/test-awe'), metadata: { workflow_name: 'phac-nml/iridanextexample', workflow_version: '1.0.2' },
    workflow_params: { assembler: 'stub' }, email_notification: false, update_samples: true }).execute
  8. In Project test awe create a new sample named test001
  9. Upload pair end data to test001
  10. Select the newly created workflow execution.
    w = WorkflowExecution.where(submitter: Project.last.namespace.automation_bot).first
  11. Make sure email notifications are enabled.
    w.email_notification = true
  12. Change state to completed or error.
    w.state = "completed"
  13. Save the workflow execution.
    w.save
  14. Check mock email service for sent email. Open a browser and navigate to http://0.0.0.0:8025/.
  15. Repeat steps for state error.

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

github-actions[bot] commented 2 months ago

Simplecov Report

Covered Threshold
92.17% 90%