Completed backend tasks to allow unsubscribing and emailing users who have opted in
Created by: RobinKavPA
PR
unsubscribe link even when user is not logged in
link with unique id
Solution
- Created new endpoint 'api/v1/person/unsubscribe/:userObjectId' to unsubscribe a user from email updates.
- Created generic email send function that accepts a list of user objects and appends an HTML footer including an optional/parameter driven user specific unsubscribe link.
- Refactored all instances of SendGrid usage to use generic send function
- Updated all email dispatch functions to take consideration of users 'opt in' status - previous sending emails based on actioner's opt status. E.g. approving a tool would send an email to all authors and admins if I as the user had opted in.
- Added de-duping to prevent sending the same emails to a contact twice. E.g. if a user is an author and an admin and any future use cases.