phac-nml / irida-next

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

Email notifications for user access when adding/removing direct members to/from a group/project #542

Closed ksierks closed 5 months ago

ksierks commented 5 months ago

What does this PR do and why?

Implemented emails for notifying the user and managers when a direct member has been added/removed to/from a group/project. Addresses another third of #476.

Note: A manager is a member that has a role of owner or maintainer.

Screenshots or screen recordings

Access granted email being sent to a user: image Access granted email being sent to a manager: imageAccess revoked email being sent to a user: imageAccess revoked email being sent to a manager: 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 to irida-next.
  5. Navigate to a group or project that the logged in user is a manager of. Alternatively, you could create a new group or project.
  6. Select the Members page.
  7. Try adding a member that doesn't already have access. (Verify inherited & group link access.)
  8. Try removing a member that only has direct access.
  9. Check mock email service for sent emails. Open a browser and navigate to http://0.0.0.0:8025/.

Note: Email previews are located at http://localhost:3000/rails/mailers/member_mailer.

PR acceptance checklist

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

ksierks commented 5 months ago

I'm wondering about moving def manager_emails out of the member destroy & create services and into a helper. Maybe call it mailer_helper? I can reference it in the tests too. What are your thoughts?

deepsidhu85 commented 5 months ago

I'm wondering about moving def manager_emails out of the member destroy & create services and into a helper. Maybe call it mailer_helper? I can reference it in the tests too. What are your thoughts?

I think that's a good idea since the methods are duplicated. And mailer_helper would be a good name!

ksierks commented 5 months ago

I'm wondering about moving def manager_emails out of the member destroy & create services and into a helper. Maybe call it mailer_helper? I can reference it in the tests too. What are your thoughts?

I think that's a good idea since the methods are duplicated. And mailer_helper would be a good name!

Done in ae2ec445e70b4c4ed166ff65ccc55e4f8e3e6277.

github-actions[bot] commented 5 months ago

Simplecov Report

Covered Threshold
91.86% 90%