This repository was archived by the owner on Sep 30, 2023. It is now read-only.
Modified email based on destination and the creation of a commendation#22
Open
Modified email based on destination and the creation of a commendation#22
Conversation
SpBills
suggested changes
Jan 5, 2023
Contributor
SpBills
left a comment
There was a problem hiding this comment.
Great! Just a few syntax things.
src/controllers/commendations.ts
Outdated
| newCommendation.date = new Date().toISOString(); | ||
|
|
||
| let isTeamCommendation = () => { | ||
| return (req.query.isTeamCommendation === "true") |
Contributor
There was a problem hiding this comment.
Hm. Why make it a function if it's scoped to here anyways? You can inline this.
Contributor
There was a problem hiding this comment.
Also, whenever we declare functions, we declare them as const since they can never be changed. Good job understanding the syntax, though.
src/utils/email.ts
Outdated
| export const emailOthers = async (commendation: Commendation, team: boolean) => { | ||
| let senderName = await getEmployeeName(commendation.fromEmail); | ||
| let userName = await getEmployeeName(commendation.toEmail); | ||
| let Subject = ""; |
src/utils/email.ts
Outdated
| to: commendation.otherEmails, | ||
| from: process.env.EMAIL, | ||
| subject: `[bz_commendations] ${userName} has received a BZ Commendation`, | ||
| subject: Subject, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the create function of the commendations controller, I added a check for if the commendation is for a team or not. In the emailOthers function of the email utils file, I modified the email based on if the commendation is for a team.