123456789101112131415161718192021222324252627282930313233 |
- import config from "config";
- import mail from "../index";
- /**
- * Sends an email to all admins that a user has submitted a data request
- * @param {string} to - an array of email addresses of admins
- * @param {string} userId - the id of the user the data request is for
- * @param {string} type - the type of data request e.g. remove
- * @param {Function} cb - gets called when an error occurred or when the operation was successful
- */
- export default (to, userId, type, cb) => {
- const data = {
- to,
- subject: `Data Request - ${type}`,
- html: `
- Hello,
- <br>
- <br>
- User ${userId} has requested to ${type} the data for their account on Musare.
- <br>
- <br>
- This request can be viewed and resolved in the
- <a href="${config.get("url.secure") ? "https" : "http"}://${config.get(
- "url.host"
- )}/admin/users">Users tab of the admin page</a>. Note: All admins will be sent the same message.
- `
- };
- mail.runJob("SEND_MAIL", { data })
- .then(() => cb())
- .catch(err => cb(err));
- };
|