Skip to content

Commit

Permalink
feat(HarvestRequests): add requester email to admin notification (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeaturner authored Jul 12, 2023
1 parent 133683b commit 6a7f588
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/api/harvestingrequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const addRequest = (req, res) => {
}).then(() => {
// ignore return value of Mailgun call
// send notification to LibreTexts team
return mailAPI.sendOERIntRequestAdminNotif(finalizedRequest.name, finalizedRequest.title);
return mailAPI.sendOERIntRequestAdminNotif(finalizedRequest.name, finalizedRequest.email, finalizedRequest.title);
}).then(() => {
// ignore return value of Mailgun call
return res.send({
Expand Down
7 changes: 4 additions & 3 deletions server/api/mail.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,13 @@ const sendOERIntRequestConfirmation = (requesterName, recipientAddress, resource
* NOTE: Do NOT use this method directly from a Conductor API route. Use internally
* only after proper verification via other internal methods.
* @param {String} requesterName - the requesting user's name ('firstName' or 'firstName lastName')
* @param {String} requesterEmail - the requesting user's email
* @param {String} resourceTitle - the resource's title/name
* @returns {Promise<Object|Error>} a Mailgun API Promise
*/
const sendOERIntRequestAdminNotif = (requesterName, resourceTitle) => {
let textToSend = `Attention: ${requesterName} has submitted a new OER Integration Request for "${resourceTitle}". This request is available in Conductor.` + autoGenNoticeText;
let htmlToSend = `<p>Attention:</p><p>${requesterName} has submitted a new OER Integration Request for "${resourceTitle}".</p><p>This request is available in Conductor.</p>` + autoGenNoticeHTML;
const sendOERIntRequestAdminNotif = (requesterName, requesterEmail, resourceTitle) => {
let textToSend = `Attention: ${requesterName ? requesterName : requesterEmail} has submitted a new OER Integration Request for "${resourceTitle}". This request is available in Conductor.` + autoGenNoticeText;
let htmlToSend = `<p>Attention:</p><p>${requesterName ? `${requesterName} (${requesterEmail})` : requesterEmail} has submitted a new OER Integration Request for "${resourceTitle}".</p><p>This request is available in Conductor.</p>` + autoGenNoticeHTML;
return mailgun.messages.create(process.env.MAILGUN_DOMAIN, {
from: 'LibreTexts Conductor <[email protected]>',
to: ['[email protected]'],
Expand Down

0 comments on commit 6a7f588

Please sign in to comment.