Skip to content

Commit

Permalink
cc on approval emails
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed May 13, 2024
1 parent f77f408 commit f6ea9a4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions media_commons_booking_app/src/policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ export const getSecondApproverEmail = (branchName: string) =>
? '[email protected]'
: '[email protected]'; // Jhanele

export const getApprovalCcEmail = (branchName: string) =>
branchName === 'development'
? '[email protected]'
: '[email protected]'; // Samantha

/********** ROOMS ************/

export type Purpose = 'multipleRoom' | 'motionCapture';
Expand Down
11 changes: 11 additions & 0 deletions media_commons_booking_app/src/server/emails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ import {
DevBranch,
} from '../types';

import { getApprovalCcEmail } from '../policy';

const getCcEmail = (status: BookingStatusLabel): string => {
if (status !== BookingStatusLabel.APPROVED) {
return '';
}
return getApprovalCcEmail(process.env.BRANCH_NAME);
};

export const sendTextEmail = (
targetEmail: string,
status: BookingStatusLabel,
Expand All @@ -14,6 +23,7 @@ export const sendTextEmail = (
const subj = `${status}: Media Commons request for \"${eventTitle}\"`;
const options = {
replyTo: '[email protected]',
cc: getCcEmail(status),
};
GmailApp.sendEmail(targetEmail, subj, body, options);
};
Expand Down Expand Up @@ -46,6 +56,7 @@ export const sendHTMLEmail = (
const options = {
htmlBody,
replyTo: '[email protected]',
cc: getCcEmail(status),
};
GmailApp.sendEmail(targetEmail, subj, body, options);
};

0 comments on commit f6ea9a4

Please sign in to comment.