phac-nml / irida-next

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

Add locale to Data Export Mailer #567

Closed ChrisHuynh333 closed 2 months ago

ChrisHuynh333 commented 2 months ago

What does this PR do and why?

This PR adds locale to the data export mailer.

Screenshots or screen recordings

image

How to set up and validate locally

  1. Load up mailhog with

    ~/go/bin/MailHog
  2. In a rails console, create a data export with email notification

    user = User.find_by(email: 'user7@email.com')
    params_1 = {'export_type' => 'sample', 'export_parameters' => {'ids' => [Sample.find_by(name: 'Yersinia pestis/Outbreak 2022 Sample 10').id]}, 'email_notification' => true, 'name' => 'test export'}
    DataExports::CreateService.new(user, params_1).execute
  3. After 30s, you should receive an email notification in maihog in english.

  4. Repeat the above but set the user locale to fr

    user = User.find_by(email: 'user7@email.com')
    user.locale = :fr
    user.save
    params_1 = {'export_type' => 'sample', 'export_parameters' => {'ids' => [Sample.find_by(name: 'Yersinia pestis/Outbreak 2022 Sample 10').id]}, 'email_notification' => true, 'name' => 'test export'}
    DataExports::CreateService.new(user, params_1).execute
  5. After 30s, the data export will complete, check the email notification in mailhog. The subject should contain Exportation Prêt and the greeting should contain Bonjour, meaning you've received the french localized email.

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.1% 90%